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

GREATEST(int_col,date_col) returns wrong results in a view

    XMLWordPrintable

Details

    Description

      DROP TABLE IF EXISTS t1;
      DROP VIEW IF EXISTS v1;
      CREATE TABLE t1 (pk INT NOT NULL, d DATE NOT NULL);
      CREATE VIEW v1 AS SELECT * FROM t1;
      INSERT INTO t1 VALUES (1,'2018-06-22'),(2,'2018-07-11');
      

      SELECT GREATEST(pk, d) FROM t1;
      

      +-----------------+
      | GREATEST(pk, d) |
      +-----------------+
      | 2018-06-22      |
      | 2018-07-11      |
      +-----------------+
      

      SELECT GREATEST(pk, d) FROM v1;
      

      +-----------------+
      | GREATEST(pk, d) |
      +-----------------+
      | NULL            |
      | NULL            |
      +-----------------+
      

      Looks wrong. Expected to get the same results with the table and with the view.

      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.