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

Wrong result on 2-nd execution of PS to select from view using derived

    XMLWordPrintable

Details

    Description

      Problem is only on merged derived table. Left join with normal table gives correct result.

      Testcase:

      create table t1 (
        Election int(10) unsigned NOT NULL
      );
       
      insert into t1 (Election) values (1);
       
      create table t2 (
        VoteID int(10),
        ElectionID int(10),
        UserID int(10)
      );
       
      insert into t2 (ElectionID, UserID) values (2,  30), (3, 30);
      create view v1 as select * from t1
        left join ( select 'Y' AS Voted, ElectionID from t2 ) AS T 
          on T.ElectionID = t1.Election
      limit 9;
       
      prepare stmt1 from "select * from v1";
       
      execute stmt1;
      execute stmt1;
       
      deallocate prepare stmt1;
       
      drop view v1;
      drop table t1, t2;
      

      Actual result:

      execute stmt1;
      Election	Voted	ElectionID
      1	NULL	NULL
      execute stmt1;
      Election	Voted	ElectionID
      1		NULL
      

      Expected result:

      execute stmt1;
      Election	Voted	ElectionID
      1	NULL	NULL
      execute stmt1;
      Election	Voted	ElectionID
      1	NULL	NULL
      

      Attachments

        Issue Links

          Activity

            People

              igor Igor Babaev
              lstartseva Lena Startseva
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Git Integration

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