Commit 87f39bf8 authored by Sergei Golubchik's avatar Sergei Golubchik

MDEV-8659 Conflicting declaration is accepted: INT SIGNED ZEROFILL

don't allow arbitrary combinations of SIGNED/UNSIGNED/ZEROFILL
parent 40eff5e0
...@@ -1219,9 +1219,6 @@ Warning 1292 Truncated incorrect INTEGER value: '1E+' ...@@ -1219,9 +1219,6 @@ Warning 1292 Truncated incorrect INTEGER value: '1E+'
Warning 1292 Truncated incorrect DECIMAL value: '1E+' Warning 1292 Truncated incorrect DECIMAL value: '1E+'
Warning 1292 Truncated incorrect DOUBLE value: '1E+' Warning 1292 Truncated incorrect DOUBLE value: '1E+'
# #
# End of 10.0 tests
#
#
# Start of 10.1 tests # Start of 10.1 tests
# #
# #
...@@ -1247,5 +1244,17 @@ Warning 1292 Truncated incorrect DOUBLE value: '' ...@@ -1247,5 +1244,17 @@ Warning 1292 Truncated incorrect DOUBLE value: ''
Warning 1292 Truncated incorrect DOUBLE value: '' Warning 1292 Truncated incorrect DOUBLE value: ''
Warning 1292 Truncated incorrect DOUBLE value: '' Warning 1292 Truncated incorrect DOUBLE value: ''
# #
# Start of 10.1 tests # Start of 10.2 tests
# #
CREATE TABLE t1 (a INT SIGNED ZEROFILL);
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'ZEROFILL)' at line 1
CREATE TABLE t1 (a INT SIGNED UNSIGNED);
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'UNSIGNED)' at line 1
CREATE TABLE t1 (a INT ZEROFILL UNSIGNED ZEROFILL);
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'ZEROFILL)' at line 1
CREATE OR REPLACE TABLE t1 (a INT SIGNED);
CREATE OR REPLACE TABLE t1 (a INT UNSIGNED);
CREATE OR REPLACE TABLE t1 (a INT ZEROFILL);
CREATE OR REPLACE TABLE t1 (a INT UNSIGNED ZEROFILL);
CREATE OR REPLACE TABLE t1 (a INT ZEROFILL UNSIGNED);
DROP TABLE t1;
...@@ -678,10 +678,6 @@ SELECT ...@@ -678,10 +678,6 @@ SELECT
# CAST('1e1000' AS DOUBLE); # CAST('1e1000' AS DOUBLE);
--echo #
--echo # End of 10.0 tests
--echo #
--echo # --echo #
--echo # Start of 10.1 tests --echo # Start of 10.1 tests
--echo # --echo #
...@@ -701,7 +697,25 @@ SELECT NULL+1 AS c0, ...@@ -701,7 +697,25 @@ SELECT NULL+1 AS c0,
--disable_metadata --disable_metadata
--enable_ps_protocol --enable_ps_protocol
--echo # --echo #
--echo # Start of 10.1 tests --echo # Start of 10.2 tests
--echo # --echo #
#
# MDEV-8659 Conflicting declaration is accepted: INT SIGNED ZEROFILL
#
--error ER_PARSE_ERROR
CREATE TABLE t1 (a INT SIGNED ZEROFILL);
--error ER_PARSE_ERROR
CREATE TABLE t1 (a INT SIGNED UNSIGNED);
--error ER_PARSE_ERROR
CREATE TABLE t1 (a INT ZEROFILL UNSIGNED ZEROFILL);
# documented syntax:
CREATE OR REPLACE TABLE t1 (a INT SIGNED);
CREATE OR REPLACE TABLE t1 (a INT UNSIGNED);
CREATE OR REPLACE TABLE t1 (a INT ZEROFILL);
# not documented, supported for backward compatibility
CREATE OR REPLACE TABLE t1 (a INT UNSIGNED ZEROFILL);
CREATE OR REPLACE TABLE t1 (a INT ZEROFILL UNSIGNED);
DROP TABLE t1;
...@@ -1952,8 +1952,8 @@ bool my_yyoverflow(short **a, YYSTYPE **b, ulong *yystacksize); ...@@ -1952,8 +1952,8 @@ bool my_yyoverflow(short **a, YYSTYPE **b, ulong *yystacksize);
procedure_list procedure_list2 procedure_item procedure_list procedure_list2 procedure_item
field_def handler opt_generated_always field_def handler opt_generated_always
opt_ignore opt_column opt_restrict opt_ignore opt_column opt_restrict
grant revoke set lock unlock string_list field_options field_option grant revoke set lock unlock string_list field_options
field_opt_list opt_binary table_lock_list table_lock opt_binary table_lock_list table_lock
ref_list opt_match_clause opt_on_update_delete use ref_list opt_match_clause opt_on_update_delete use
opt_delete_options opt_delete_option varchar nchar nvarchar opt_delete_options opt_delete_option varchar nchar nvarchar
opt_outer table_list table_name table_alias_ref_list table_alias_ref opt_outer table_list table_name table_alias_ref_list table_alias_ref
...@@ -6557,18 +6557,11 @@ precision: ...@@ -6557,18 +6557,11 @@ precision:
field_options: field_options:
/* empty */ {} /* empty */ {}
| field_opt_list {} | SIGNED_SYM {}
;
field_opt_list:
field_opt_list field_option {}
| field_option {}
;
field_option:
SIGNED_SYM {}
| UNSIGNED { Lex->last_field->flags|= UNSIGNED_FLAG;} | UNSIGNED { Lex->last_field->flags|= UNSIGNED_FLAG;}
| ZEROFILL { Lex->last_field->flags|= UNSIGNED_FLAG | ZEROFILL_FLAG; } | ZEROFILL { Lex->last_field->flags|= UNSIGNED_FLAG | ZEROFILL_FLAG; }
| UNSIGNED ZEROFILL { Lex->last_field->flags|= UNSIGNED_FLAG | ZEROFILL_FLAG; }
| ZEROFILL UNSIGNED { Lex->last_field->flags|= UNSIGNED_FLAG | ZEROFILL_FLAG; }
; ;
field_length: field_length:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment