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

FIRST_VALUE() does not preserve the exact data type

    XMLWordPrintable

    Details

      Description

      CREATE OR REPLACE TABLE t1 (a INT, b INT, c FLOAT);
      INSERT INTO t1 VALUES (1,1,1),(1,2,2),(2,1,1),(2,2,2);
      CREATE OR REPLACE TABLE t2 AS SELECT a, FIRST_VALUE(b) OVER(), FIRST_VALUE(c) OVER() FROM t1 GROUP BY a;
      SHOW CREATE TABLE t2;
      

      +-------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
      | Table | Create Table                                                                                                                                                                            |
      +-------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
      | t2    | CREATE TABLE `t2` (
        `a` int(11) DEFAULT NULL,
        `FIRST_VALUE(b) OVER()` bigint(11) DEFAULT NULL,
        `FIRST_VALUE(c) OVER()` double DEFAULT NULL
      ) ENGINE=InnoDB DEFAULT CHARSET=latin1 |
      +-------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
      

      Notice:

      • INT(11) became BIGINT(11)
      • FLOAT became DOUBLE

        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: