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

Different representation of bit values depending on presence of views and derived tables

    XMLWordPrintable

Details

    • Bug
    • Status: Open (View Workflow)
    • Minor
    • Resolution: Unresolved
    • 5.5, 10.0, 10.1, 10.2, 10.3, 10.4
    • 10.4
    • Data types, Optimizer
    • None

    Description

      Note: see also MDEV-12406

      MariaDB [test]> SELECT DISTINCT b FROM v1;
      +------+
      | b    |
      +------+
      |  113 |
      | NULL |
      +------+
      2 rows in set (0.01 sec)
       
      MariaDB [test]> SELECT * FROM ( SELECT DISTINCT b FROM v1 ) cte;
      +-------+
      | b     |
      +-------+
      |     q |
      | NULL  |
      +-------+
      2 rows in set (0.00 sec)
      

      Consequently, CTEs in 10.2 are also affected:

      MariaDB [test]> SELECT DISTINCT b FROM v1;
      +------+
      | b    |
      +------+
      |  113 |
      | NULL |
      +------+
      2 rows in set (0.00 sec)
       
      MariaDB [test]> WITH cte AS ( SELECT DISTINCT b FROM v1 ) SELECT * FROM cte;
      +-------+
      | b     |
      +-------+
      |     q |
      | NULL  |
      +-------+
      2 rows in set (0.00 sec)
      

      Test case

      DROP VIEW IF EXISTS v1;
      DROP TABLE IF EXISTS t1;
       
      CREATE TABLE t1 (b BIT(35));
      CREATE ALGORITHM=MERGE VIEW v1 AS SELECT * FROM t1;
      INSERT INTO t1 VALUES (b'01110001'),(NULL);
       
      SELECT DISTINCT b FROM v1;
      SELECT * FROM ( SELECT DISTINCT b FROM v1 ) cte;
      WITH cte AS ( SELECT DISTINCT b FROM v1 ) SELECT * FROM cte;
      

      Attachments

        Issue Links

          Activity

            People

              bar Alexander Barkov
              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.