Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-28585

Wrong result for view defined as SELECT ROW(1,2,3) = (SELECT 1,2,NULL)

    XMLWordPrintable

Details

    • Bug
    • Status: Open (View Workflow)
    • Critical
    • Resolution: Unresolved
    • 10.3(EOL), 10.4(EOL), 10.5, 10.6, 10.7(EOL), 10.8(EOL), 10.9(EOL)
    • 10.11
    • None

    Description

      Query

      SELECT ROW(1,2,3) = (SELECT 1,2,NULL);
      

      return as result

      NULL
      

      But the view with such definition returns 0:

      Test:

      CREATE VIEW v1 as SELECT ROW(1,2,3) = (SELECT 1,2,NULL);
      SELECT * FROM v1;
       
      DROP VIEW v1;
      

      Actual result:

      ROW(1,2,3) = (SELECT 1,2,NULL)
      0
      

      Query plans are also very different:
      select

      EXPLAIN EXTENDED SELECT ROW(1,2,3) = (SELECT 1,2,NULL);
      id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
      1	PRIMARY	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	No tables used
      2	SUBQUERY	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	No tables used
      Warnings:
      Note	1003	/* select#1 */ select (1,2,3) = (/* select#2 */ select 1,2,NULL) AS `ROW(1,2,3) = (SELECT 1,2,NULL)`
      

      view

      CREATE VIEW v1 as SELECT ROW(1,2,3) = (SELECT 1,2,NULL);
      EXPLAIN EXTENDED SELECT * FROM v1;
      id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
      1	PRIMARY	<derived2>	system	NULL	NULL	NULL	NULL	1	100.00	
      2	DERIVED	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	No tables used
      3	SUBQUERY	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	No tables used
      Warnings:
      Note	1003	/* select#1 */ select 0 AS `ROW(1,2,3) = (SELECT 1,2,NULL)` from dual
      

      Attachments

        Issue Links

          Activity

            People

              sanja Oleksandr Byelkin
              lstartseva Lena Startseva
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:

                Git Integration

                  Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.