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

Seemingly different result upon aggregate function on BIT column directly vs subquery

    XMLWordPrintable

Details

    • Bug
    • Status: Open (View Workflow)
    • Minor
    • Resolution: Unresolved
    • 10.3, 10.4, 10.5, 10.6, 10.7, 10.8, 10.9, 10.10, 10.11
    • 10.4, 10.5, 10.6
    • Data types
    • None

    Description

      CREATE TABLE t (b BIT);
      INSERT INTO t VALUES (0);
       
      SELECT MIN(b) AS f FROM t;
      SELECT f FROM (SELECT MIN(b) AS f FROM t) sq;
       
      # Cleanup
      DROP TABLE t;
      

      10.3 0ca3aaa7

      MariaDB [test]> SELECT MIN(b) AS f FROM t;
      +------+
      | f    |
      +------+
      | 0    |
      +------+
      1 row in set (0.001 sec)
       
      MariaDB [test]> SELECT f FROM (SELECT MIN(b) AS f FROM t) sq;
      +------+
      | f    |
      +------+
      |      |
      +------+
      1 row in set (0.001 sec)
      

      With column type info:

      MariaDB [test]> SELECT MIN(b) AS f FROM t;
      Field   1:  `f`
      Catalog:    `def`
      Database:   ``
      Table:      ``
      Org_table:  ``
      Type:       BIT
      Collation:  binary (63)
      Length:     1
      Max_length: 1
      Decimals:   0
      Flags:      UNSIGNED BINARY 
       
       
      +------+
      | f    |
      +------+
      | 0    |
      +------+
      1 row in set (0.001 sec)
       
      MariaDB [test]> SELECT f FROM (SELECT MIN(b) AS f FROM t) sq;
      Field   1:  `f`
      Catalog:    `def`
      Database:   ``
      Table:      `sq`
      Org_table:  `t`
      Type:       BIT
      Collation:  binary (63)
      Length:     1
      Max_length: 1
      Decimals:   0
      Flags:      UNSIGNED 
      

      Attachments

        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.