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

    Details

    • Type: Bug
    • Status: Open (View Workflow)
    • Priority: Minor
    • Resolution: Unresolved
    • Affects Version/s: 5.5, 10.0, 10.1, 10.2, 10.3, 10.4
    • Fix Version/s: 10.4
    • Component/s: Data types, Optimizer
    • Labels:
      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

              • Assignee:
                bar Alexander Barkov
                Reporter:
                elenst Elena Stepanova
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated: