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

Xmltype default values inconsistency is not checked

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Critical
    • Resolution: Fixed
    • N/A
    • 12.3.1
    • Data types
    • None
    • Can result in unexpected behaviour
    • Q1/2026 Server Maintenance

    Description

      MariaDB [test]> select b + 1 from t1;
      ERROR 4078 (HY000): Illegal parameter data types xmltype and int for operation '+'
       
      MariaDB [test]> CREATE or replace TABLE t2 (a INT, b xmltype as (a+1));
      ERROR 4078 (HY000): Cannot cast 'bigint' as 'xmltype' in assignment of `test`.`t2`.`b`
      

      but it is allowed as a default:

      MariaDB [test]> CREATE or replace TABLE t2 (a INT, b xmltype default (a+1));
      Query OK, 0 rows affected (0,039 sec)
       
      MariaDB [test]> insert into t2(a) select 5;
      Query OK, 1 row affected (0,016 sec)
      Records: 1  Duplicates: 0  Warnings: 0
       
      MariaDB [test]> select * from t2;
      +------+------+
      | a    | b    |
      +------+------+
      |    5 | 6    |
      +------+------+
      1 row in set (0,003 sec)
      

      MariaDB [test]> create sequence s;
      Query OK, 0 rows affected (0,043 sec)
       
      MariaDB [test]> create table t ( a xmltype default nextval(s));
      Query OK, 0 rows affected (0,038 sec)
       
      MariaDB [test]> insert into t select nextval(s);
      ERROR 4078 (HY000): Cannot cast 'bigint' as 'xmltype' in assignment of `test`.`t`.`a`
       
      MariaDB [test]> insert into t values ();
      Query OK, 1 row affected (0,015 sec)
      

      Attachments

        Issue Links

          Activity

            People

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