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

Wrong result set metadata for DIV

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Major
    • Resolution: Fixed
    • 10.1(EOL), 10.2(EOL), 10.3(EOL)
    • 10.3.1
    • OTHER

    Description

      SELECT 2 DIV 1;
      

      Field   1:  `2 DIV 1`
      Type:       LONGLONG
      Collation:  binary (63)
      Length:     1
      Max_length: 1
      Decimals:   0
      Flags:      BINARY NUM
      

      CREATE OR REPLACE TABLE t1 AS SELECT 2 DIV 1 AS c;
      DESCRIBE t1;
      

      +-------+--------+------+-----+---------+-------+
      | Field | Type   | Null | Key | Default | Extra |
      +-------+--------+------+-----+---------+-------+
      | c     | int(1) | YES  |     | NULL    |       |
      +-------+--------+------+-----+---------+-------+
      

      Notice, result set metadata for SELECT 2 DIV 1 reports the data type as LONGLONG. This looks wrong.
      A CREATE..SELECT query for the same expression correctly makes an INT column.
      Result set metadata should be fixed to report LONG for all DIV expressions creating an INT column. LONGLONG should be reported only for DIV making a BIGINT column in CREATE..SELECT.

      Attachments

        Issue Links

          Activity

            People

              bar Alexander Barkov
              bar Alexander Barkov
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Git Integration

                  Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.