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

[Draft] Wrong results upon queries involving indexed virtual column

    XMLWordPrintable

    Details

      Description

      The attached SQL contains a dump of table t and ends with this (to be a test case):

      create or replace table t2 like t;
      insert ignore into t2 select * from t;
       
      SELECT COUNT(*) FROM t2 WHERE id in (1,2) AND vcol_int = 1;
      SELECT COUNT(*) FROM t2 WHERE id = 1 AND vcol_int = 1;
      SELECT COUNT(*) FROM t2 WHERE id in (1,2) AND col_int = 1;
      

      And the result on current 10.5+ is

      COUNT(*)
      1
      COUNT(*)
      6
      COUNT(*)
      10
      

      Which of course is meaningless, since the first SELECT is more inclusive than the second one; for the third, while it's not obvious from the above, the result should be identical to the first one as vcol_int is a virtual column defined as AS (col_int). The third result is likely to be the correct one, although I didn't check it yet.

        Attachments

          Activity

            People

            Assignee:
            elenst Elena Stepanova
            Reporter:
            elenst Elena Stepanova
            Votes:
            0 Vote for this issue
            Watchers:
            1 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.