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

Hybrid functions do not preserve geometry type

    XMLWordPrintable

Details

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

    Description

      DROP TABLE IF EXISTS t1;
      CREATE TABLE t1 AS SELECT
        Point(0,0) AS p0,
        COALESCE(Point(0,0)) AS p1,
        CASE WHEN 0 THEN Point(0,0) ELSE Point(1,1) END AS p2;
      SHOW CREATE TABLE t1;
      

      returns

      +-------+--------------------------------------------------------------------------------------------------------------------------------------------------+
      | Table | Create Table                                                                                                                                     |
      +-------+--------------------------------------------------------------------------------------------------------------------------------------------------+
      | t1    | CREATE TABLE `t1` (
        `p0` point DEFAULT NULL,
        `p1` geometry DEFAULT NULL,
        `p2` geometry DEFAULT NULL
      ) ENGINE=InnoDB DEFAULT CHARSET=latin1 |
      +-------+--------------------------------------------------------------------------------------------------------------------------------------------------+
      

      The expected behavior would be to the POINT data type for all three columns.

      The same problem is demonstrated with LEAST and GREATEST:

      DROP TABLE IF EXISTS t1;
      CREATE TABLE t1 AS SELECT
        LEAST(Point(0,0),Point(0,0)) AS p1;
      SHOW CREATE TABLE t1;
      

      +-------+-----------------------------------------------------------------------------------------+
      | Table | Create Table                                                                            |
      +-------+-----------------------------------------------------------------------------------------+
        `p1` geometry DEFAULT NULL
      | t1    | CREATE TABLE `t1` (
      ) ENGINE=InnoDB DEFAULT CHARSET=latin1 |
      +-------+-----------------------------------------------------------------------------------------+
      

      Attachments

        Issue Links

          Activity

            People

              bar Alexander Barkov
              bar Alexander Barkov
              Votes:
              0 Vote for this issue
              Watchers:
              2 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.