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

Data type of @a:=1e0 depends on the session character set

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 10.1, 10.2, 10.3
    • Fix Version/s: 10.3.1
    • Component/s: OTHER
    • Labels:

      Description

      I start mysql --column-type-info test and run this script:

      SET NAMES latin1;
      CREATE OR REPLACE TABLE t1 AS SELECT @:=1e0;
      SELECT * FROM t1;
      

      It reports the following metadata:

      Field   1:  `@:=1e0`
      Type:       DOUBLE
      Collation:  binary (63)
      Length:     3
      Max_length: 1
      Decimals:   31
      

      Now I run the same script, with latin1 changed to utf8:

      SET NAMES utf8;
      CREATE OR REPLACE TABLE t1 AS SELECT @:=1e0;
      SELECT * FROM t1;
      

      Metadata changes to:

      Field   1:  `@:=1e0`
      Type:       DOUBLE
      Collation:  binary (63)
      Length:     9
      Max_length: 1
      Decimals:   31
      

      Notice, it reports length as 3 and 9 for latin1 and utf8 session character sets respectively.
      Looks wrong. It should not depent on the session character set.

        Attachments

          Issue Links

            Activity

              People

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

                Dates

                • Created:
                  Updated:
                  Resolved: