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

Views based on FROM DUAL selects always evaluate all columns

    XMLWordPrintable

Details

    • Bug
    • Status: Open (View Workflow)
    • Minor
    • Resolution: Unresolved
    • 5.5(EOL), 10.0(EOL), 10.1(EOL)
    • 10.1(EOL)
    • Optimizer
    • None

    Description

      CREATE OR REPLACE ALGORITHM = MERGE VIEW v AS
      SELECT 1 a, SLEEP(3) b, SLEEP(3) c FROM DUAL;
       
      EXPLAIN EXTENDED
      SELECT a FROM v;

      EXPLAIN EXTENDED shows us what we want to see... but it's a lie If you execute the SELECT, it will sleep for 6 seconds, because columns b and c are evaluated.

      Note that the bug will NOT happen in this case:

      \W
       
      CREATE OR REPLACE TABLE t (a INT) ENGINE = InnoDB;
      INSERT INTO t VALUES (1);
       
      CREATE OR REPLACE ALGORITHM = MERGE VIEW v AS
      SELECT a, SLEEP(3) b, SLEEP(3) c FROM t;
       
      EXPLAIN EXTENDED
      SELECT a FROM v;

      Attachments

        Activity

          People

            sanja Oleksandr Byelkin
            f_razzoli Federico Razzoli
            Votes:
            0 Vote for this issue
            Watchers:
            5 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.