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(EOL), 10.0(EOL), 10.1(EOL), 10.2(EOL), 10.3(EOL), 10.4(EOL)
    • 10.4(EOL)
    • 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.