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

Unexpected error "Unknown column 'c0' in 'ORDER BY'" in a prepared SELECT without ORDER BY

    XMLWordPrintable

Details

    Description

      Hi,

      In the following test case, the prepared SELECT does not have a ORDER BY clause, however, it triggers an error "Unknown column 'c0' in 'ORDER BY'"

      CREATE TABLE IF NOT EXISTS t0(c0 REAL UNSIGNED  UNIQUE);
      CREATE TABLE t1(c0 REAL SIGNED  UNIQUE);
      CREATE OR REPLACE TABLE t2 LIKE t1;
      SET @a = '';
      SET @b = '';
      SET @c = '';
      PREPARE prepare_query FROM 'SELECT subq_0.subq_0_c0 FROM t1 STRAIGHT_JOIN (SELECT (- ?) AS subq_0_c0, (- t2.c0) AS subq_0_c1 FROM t0 STRAIGHT_JOIN t2 ON t2.c0 WHERE ? GROUP BY (- ?), (- t2.c0)) AS subq_0 ON ((subq_0.subq_0_c1 IS FALSE) NOT IN (subq_0.subq_0_c0))';
      EXECUTE prepare_query USING @a,@b,@c; -- Unknown column 'c0' in 'ORDER BY'
      

      I can trigger this on 12.1.2-MariaDB-ubu2404.

      Attachments

        Issue Links

          Activity

            People

              serg Sergei Golubchik
              ChiZhang Chi Zhang
              Votes:
              0 Vote for this issue
              Watchers:
              3 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.