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

View returns different value for min(year) function

    XMLWordPrintable

Details

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

    Description

      The view created as:

      CREATE TABLE t1(c1 YEAR(4));
      INSERT INTO t1 VALUES (1901),(2155),(0000);
      CREATE VIEW v1 AS SELECT COUNT(*) AS total_rows, MIN(c1) AS min_value, MAX(c1) FROM t1;
      SELECT * FROM v1;
      DROP VIEW v1;
      DROP TABLE t1;
      

      gives result:

      total_rows	min_value	MAX(c1)
      3	0000	2155
      

      but view created as:

      CREATE TABLE t1(c1 YEAR(4));
      INSERT INTO t1 VALUES (1901),(2155),(0000);
      CREATE VIEW v2 AS SELECT COUNT(*) AS total_rows, MIN(c1+0) AS min_value, MAX(c1+0) FROM t1;
      SELECT * FROM v2;
      DROP VIEW v2;
      DROP TABLE t1;
      

      gives other result:

      total_rows	min_value	MAX(c1+0)
      3	0	2155
      

      Attachments

        Issue Links

          Activity

            People

              sanja Oleksandr Byelkin
              lstartseva Lena Startseva
              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.