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

XMLTYPE value stored in a user variable loses the type (and hence all checks), becomes longtext

    XMLWordPrintable

Details

    • Bug
    • Status: Open (View Workflow)
    • Major
    • Resolution: Unresolved
    • 12.3
    • 12.3
    • XML
    • None

    Description

      MariaDB [test]> set @x=CAST('<a/>' AS XMLTYPE);
      Query OK, 0 rows affected (0,001 sec)
       
      MariaDB [test]> select @x+1;
      +------+
      | @x+1 |
      +------+
      |    1 |
      +------+
      1 row in set (0,001 sec)
       
      MariaDB [test]> create table tb as select @x;
      Query OK, 1 row affected (0,060 sec)
      Records: 1  Duplicates: 0  Warnings: 0
       
      MariaDB [test]> show create table tb;
      +-------+------------------------------------------------------------------------------------------------------------------------+
      | Table | Create Table                                                                                                           |
      +-------+------------------------------------------------------------------------------------------------------------------------+
      | tb    | CREATE TABLE `tb` (
        `@x` longtext DEFAULT NULL
      ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci |
      +-------+------------------------------------------------------------------------------------------------------------------------+
      1 row in set (0,001 sec)
      

      compare with geometry:

      MariaDB [test]> set @x= PointFromText('POINT(10 10)');
      Query OK, 0 rows affected (0,010 sec)
       
      MariaDB [test]> select @x;
      +---------------------------+
      | @x                        |
      +---------------------------+
      |              $@      $@ |
      +---------------------------+
      1 row in set (0,001 sec)
       
      MariaDB [test]> select @x+1;
      ERROR 4078 (HY000): Illegal parameter data types geometry and int for operation '+'
       
      MariaDB [test]> create table  tb2 as select @x;
      Query OK, 1 row affected (0,058 sec)
      Records: 1  Duplicates: 0  Warnings: 0
       
      MariaDB [test]> show create table tb2;
      +-------+-------------------------------------------------------------------------------------------------------------------------+
      | Table | Create Table                                                                                                            |
      +-------+-------------------------------------------------------------------------------------------------------------------------+
      | tb2   | CREATE TABLE `tb2` (
        `@x` geometry DEFAULT NULL
      ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci |
      +-------+-------------------------------------------------------------------------------------------------------------------------+
      1 row in set (0,001 sec)
      

      Attachments

        Issue Links

          Activity

            People

              holyfoot Alexey Botchkov
              alice Alice Sherepa
              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.