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

Allow reserved keywords as user defined type names

    XMLWordPrintable

    Details

      Description

      To avoid compatibility problems in the future, let's allow non-conflicting reserved keywords as user defined type (UDT) names.

      This will allow to avoid backticking of user-defined data type names in SHOW CREATE TABLE and mysqldump.

      So SHOW CREATE TABLE, instead of returning:

      CREATE TABLE t1 (a `udt`);
      

      will return:

      CREATE TABLE t1 (a udt);
      

      which is easier to read.

      The list of tokens that cannot be used as UDT names (because they cause grammar conflicts with built-in data type names) in 10.5 includes:

      • BIGINT
      • BINARY
      • BLOB_MARIADB_SYM
      • BLOB_ORACLE_SYM
      • CHAR_SYM
      • CONDITION_SYM
      • CURSOR_SYM
      • DECIMAL_SYM
      • DOUBLE_SYM
      • FLOAT_SYM
      • FOR_SYM
      • INT_SYM
      • LONGBLOB
      • LONGTEXT
      • LONG_SYM
      • MEDIUMBLOB
      • MEDIUMINT
      • MEDIUMTEXT
      • NUMERIC_SYM
      • REAL
      • SET
      • SMALLINT
      • TINYBLOB
      • TINYINT
      • TINYTEXT
      • UNSIGNED
      • VARBINARY
      • VARCHAR

      All other reserved keywords do not cause conflicts and can be used as UDT names.

      Examples:

      CREATE TABLE t1 (a DUAL);
      SELECT CAST(a AS DUAL);
      

      Before this change, the parser returns a syntax error:

      ERROR 1064 (42000): You have an error in your SQL syntax .. near 'DUAL)' at line 1
      

      After this change, the query will pass the parser syntactically. A different error will be returned:

      ERROR 4161 (HY000): Unknown data type: 'DUAL'
      

      The list of allowed reserved keyword includes:

      • ACCESSIBLE_SYM
      • ADD
      • ALL
      • ALTER
      • ANALYZE_SYM
      • AND_SYM
      • AS
      • ASC
      • ASENSITIVE_SYM
      • BEFORE_SYM
      • BETWEEN_SYM
      • BIT_AND
      • BIT_OR
      • BIT_XOR
      • BODY_ORACLE_SYM
      • BOTH
      • BY
      • CALL_SYM
      • CASCADE
      • CASE_SYM
      • CAST_SYM
      • CHANGE
      • CHECK_SYM
      • COLLATE_SYM
      • CONSTRAINT
      • CONTINUE_MARIADB_SYM
      • CONTINUE_ORACLE_SYM
      • CONVERT_SYM
      • COUNT_SYM
      • CREATE
      • CROSS
      • CUME_DIST_SYM
      • CURDATE
      • CURRENT_USER
      • CURRENT_ROLE
      • CURTIME
      • DATABASE
      • DATABASES
      • DATE_ADD_INTERVAL
      • DATE_SUB_INTERVAL
      • DAY_HOUR_SYM
      • DAY_MICROSECOND_SYM
      • DAY_MINUTE_SYM
      • DAY_SECOND_SYM
      • DECLARE_MARIADB_SYM
      • DECLARE_ORACLE_SYM
      • DEFAULT
      • DELETE_DOMAIN_ID_SYM
      • DELETE_SYM
      • DENSE_RANK_SYM
      • DESC
      • DESCRIBE
      • DETERMINISTIC_SYM
      • DISTINCT
      • DIV_SYM
      • DO_DOMAIN_IDS_SYM
      • DROP
      • DUAL_SYM
      • EACH_SYM
      • ELSE
      • ELSEIF_MARIADB_SYM
      • ELSIF_ORACLE_SYM
      • ENCLOSED
      • ESCAPED
      • EXCEPT_SYM
      • EXISTS
      • EXTRACT_SYM
      • FALSE_SYM
      • FETCH_SYM
      • FIRST_VALUE_SYM
      • FOREIGN
      • FROM
      • FULLTEXT_SYM
      • GOTO_ORACLE_SYM
      • GRANT
      • GROUP_SYM
      • GROUP_CONCAT_SYM
      • LAG_SYM
      • LEAD_SYM
      • HAVING
      • HOUR_MICROSECOND_SYM
      • HOUR_MINUTE_SYM
      • HOUR_SECOND_SYM
      • IF_SYM
      • IGNORE_DOMAIN_IDS_SYM
      • IGNORE_SYM
      • INDEX_SYM
      • INFILE
      • INNER_SYM
      • INOUT_SYM
      • INSENSITIVE_SYM
      • INSERT
      • INTERSECT_SYM
      • INTERVAL_SYM
      • INTO
      • IN_SYM
      • IS
      • ITERATE_SYM
      • JOIN_SYM
      • KEYS
      • KEY_SYM
      • KILL_SYM
      • LEADING
      • LEAVE_SYM
      • LEFT
      • LIKE
      • LIMIT
      • LINEAR_SYM
      • LINES
      • LOAD
      • LOCATOR_SYM
      • LOCK_SYM
      • LOOP_SYM
      • LOW_PRIORITY
      • MASTER_SSL_VERIFY_SERVER_CERT_SYM
      • MATCH
      • MAX_SYM
      • MAXVALUE_SYM
      • MEDIAN_SYM
      • MINUTE_MICROSECOND_SYM
      • MINUTE_SECOND_SYM
      • MIN_SYM
      • MODIFIES_SYM
      • MOD_SYM
      • NATURAL
      • NEG
      • NOT_SYM
      • NOW_SYM
      • NO_WRITE_TO_BINLOG
      • NTILE_SYM
      • NULL_SYM
      • NTH_VALUE_SYM
      • ON
      • OPTIMIZE
      • OPTIONALLY
      • ORDER_SYM
      • OR_SYM
      • OTHERS_ORACLE_SYM
      • OUTER
      • OUTFILE
      • OUT_SYM
      • OVER_SYM
      • PACKAGE_ORACLE_SYM
      • PAGE_CHECKSUM_SYM
      • PARSE_VCOL_EXPR_SYM
      • PARTITION_SYM
      • PERCENT_RANK_SYM
      • PERCENTILE_CONT_SYM
      • PERCENTILE_DISC_SYM
      • PORTION_SYM
      • POSITION_SYM
      • PRECISION
      • PRIMARY_SYM
      • PROCEDURE_SYM
      • PURGE
      • RAISE_ORACLE_SYM
      • RANGE_SYM
      • RANK_SYM
      • READS_SYM
      • READ_SYM
      • READ_WRITE_SYM
      • RECURSIVE_SYM
      • REF_SYSTEM_ID_SYM
      • REFERENCES
      • REGEXP
      • RELEASE_SYM
      • RENAME
      • REPEAT_SYM
      • REPLACE
      • REQUIRE_SYM
      • RESIGNAL_SYM
      • RESTRICT
      • RETURNING_SYM
      • RETURN_MARIADB_SYM
      • RETURN_ORACLE_SYM
      • REVOKE
      • RIGHT
      • ROWS_SYM
      • ROWTYPE_ORACLE_SYM
      • ROW_NUMBER_SYM
      • SECOND_MICROSECOND_SYM
      • SELECT_SYM
      • SENSITIVE_SYM
      • SEPARATOR_SYM
      • SERVER_OPTIONS
      • SHOW
      • SIGNAL_SYM
      • SPATIAL_SYM
      • SPECIFIC_SYM
      • SQLEXCEPTION_SYM
      • SQLSTATE_SYM
      • SQLWARNING_SYM
      • SQL_BIG_RESULT
      • SQL_SMALL_RESULT
      • SQL_SYM
      • SSL_SYM
      • STARTING
      • STATS_AUTO_RECALC_SYM
      • STATS_PERSISTENT_SYM
      • STATS_SAMPLE_PAGES_SYM
      • STDDEV_SAMP_SYM
      • STD_SYM
      • STRAIGHT_JOIN
      • SUBSTRING
      • SUM_SYM
      • SYSDATE
      • TABLE_REF_PRIORITY
      • TABLE_SYM
      • TERMINATED
      • THEN_SYM
      • TO_SYM
      • TRAILING
      • TRIGGER_SYM
      • TRIM
      • TRUE_SYM
      • UNDO_SYM
      • UNION_SYM
      • UNIQUE_SYM
      • UNLOCK_SYM
      • UPDATE_SYM
      • USAGE
      • USE_SYM
      • USING
      • UTC_DATE_SYM
      • UTC_TIMESTAMP_SYM
      • UTC_TIME_SYM
      • VALUES
      • VALUES_IN_SYM
      • VALUES_LESS_SYM
      • VARIANCE_SYM
      • VARYING
      • VAR_SAMP_SYM
      • WHEN_SYM
      • WHERE
      • WHILE_SYM
      • WITH
      • XOR
      • YEAR_MONTH_SYM
      • ZEROFILL

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              bar Alexander Barkov
              Reporter:
              bar Alexander Barkov
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: