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

2nd execution name resolution problem with pushdown into unions

Details

    Description

      create table t1 (c1 int, c2 int, c3 int);
      insert into t1 values (1,2,3),(4,5,6);
      create table t2 like t1;
      insert into t2 values (7,8,9),(10,11,12);
      create view v1 (f1, f2, f3) as select * from (
        select c1, c2, sum(c3) as s from t1 group by c1, c2 having s > 2
        union
        select c1, c2, sum(c3) as u from t2 group by c1, c2 having u > 3 ) d2;
      prepare stmt from 'select * from v1 where f2 > 0';
      execute stmt;
      execute stmt;
      

      first execution gives the correct answer

      +------+------+------+
      | f1   | f2   | f3   |
      +------+------+------+
      |    1 |    2 |    3 |
      |    4 |    5 |    6 |
      |    7 |    8 |    9 |
      |   10 |   11 |   12 |
      +------+------+------+
      

      2nd execution does not

      ERROR 1356 (HY000): View 'test.v1' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them
      

      I have solved this problem in the linked MDEV, but it will be worth backporting the fix to earlier versions.

      Attachments

        Issue Links

          Activity

            Transition Time In Source Status Execution Times
            Rex Johnston made transition -
            Open In Progress
            2h 8m 1
            Rex Johnston made transition -
            In Progress In Review
            17h 9m 1
            Rex Johnston made transition -
            Stalled In Progress
            4s 1
            Igor Babaev (Inactive) made transition -
            In Progress Needs Feedback
            4d 19h 44m 1
            Rex Johnston made transition -
            Needs Feedback Closed
            2m 35s 1
            Rex Johnston made transition -
            Closed Stalled
            8s 1
            Rex Johnston made transition -
            Stalled In Review
            24s 1
            Igor Babaev (Inactive) made transition -
            In Review Stalled
            22d 6h 43m 2
            Rex Johnston made transition -
            Stalled Closed
            49m 21s 1

            People

              Johnston Rex Johnston
              Johnston Rex Johnston
              Votes:
              1 Vote for this issue
              Watchers:
              3 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.