summaryrefslogtreecommitdiff
path: root/sql/sql_yacc_ora.yy
diff options
context:
space:
mode:
authorAlexander Barkov <bar@mariadb.com>2019-06-18 04:58:15 +0400
committerAlexander Barkov <bar@mariadb.com>2019-06-18 07:48:08 +0400
commit5352e9687a86094d19aaea605970487516e99ab5 (patch)
tree40f765c43fcfd46d53e56edd4753223f0000cced /sql/sql_yacc_ora.yy
parent3784ed7a623ccc55a4755efeeb2f9ba06c7baf4e (diff)
downloadmariadb-git-5352e9687a86094d19aaea605970487516e99ab5.tar.gz
MDEV-17363 - Compressed columns cannot be restored from dump
In collaboration with Sergey Vojtovich <svoj@mariadb.org> The COMPRESSED clause is now a part of the data type and goes immediately after the data type and length, but before the CHARACTER SET clause, and before column attributes such as DEFAULT, COLLATE, ON UPDATE, SYSTEM VERSIONING, engine specific column attributes. In the old reduction, the COMPRESSED clause was a column attribute. New syntax: <varchar or text data type> <length> <compression> <character set> <column attributes> <varbinary or blob data type> <length> <compression> <column attributes> New syntax examples: VARCHAR(1000) COMPRESSED CHARACTER SET latin1 DEFAULT '' BLOB COMPRESSED DEFAULT '' Deprecate syntax examples: VARCHAR(1000) CHARACTER SET latin1 COMPRESSED DEFAULT '' TEXT CHARACTER SET latin1 DEFAULT '' COMPRESSED VARBINARY(1000) DEFAULT '' COMPRESSED As a side effect: - COMPRESSED is not valid as an SP label name in SQL/PSM routines any more (but it's still valid as an SP label name in sql_mode=ORACLE) - COMPRESSED is now allowed in combination with GENERATED ALWAYS AS: TEXT COMPRESSED GENERATED ALWAYS AS REPEAT('a',1000)
Diffstat (limited to 'sql/sql_yacc_ora.yy')
-rw-r--r--sql/sql_yacc_ora.yy113
1 files changed, 76 insertions, 37 deletions
diff --git a/sql/sql_yacc_ora.yy b/sql/sql_yacc_ora.yy
index fcf0dc01562..1ba77dcd16e 100644
--- a/sql/sql_yacc_ora.yy
+++ b/sql/sql_yacc_ora.yy
@@ -278,10 +278,10 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize);
%parse-param { THD *thd }
%lex-param { THD *thd }
/*
- Currently there are 53 shift/reduce conflicts.
+ Currently there are 55 shift/reduce conflicts.
We should not introduce new conflicts any more.
*/
-%expect 53
+%expect 55
/*
Comments for TOKENS.
@@ -1495,7 +1495,10 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize);
ref_list opt_match_clause opt_on_update_delete use
opt_delete_options opt_delete_option varchar nchar nvarchar
opt_outer table_list table_name table_alias_ref_list table_alias_ref
- opt_attribute opt_attribute_list attribute column_list column_list_id
+ attribute attribute_list
+ compressed_deprecated_data_type_attribute
+ compressed_deprecated_column_attribute
+ column_list column_list_id
opt_column_list grant_privileges grant_ident grant_list grant_option
object_privilege object_privilege_list user_list user_and_role_list
rename_list table_or_tables
@@ -6625,7 +6628,10 @@ opt_asrow_attribute_list:
;
field_def:
- opt_attribute
+ /* empty */ { }
+ | attribute_list
+ | attribute_list compressed_deprecated_column_attribute
+ | attribute_list compressed_deprecated_column_attribute attribute_list
| opt_generated_always AS virtual_column_func
{
Lex->last_field->vcol_info= $3;
@@ -6821,6 +6827,13 @@ field_type_numeric:
;
+opt_binary_and_compression:
+ /* empty */
+ | binary
+ | binary compressed_deprecated_data_type_attribute
+ | compressed opt_binary
+ ;
+
field_type_string:
char opt_field_length_default_1 opt_binary
{
@@ -6836,25 +6849,25 @@ field_type_string:
Lex->charset=&my_charset_bin;
$$.set(&type_handler_string, $2);
}
- | varchar field_length opt_binary
+ | varchar field_length opt_binary_and_compression
{
$$.set(&type_handler_varchar, $2);
}
- | VARCHAR2_ORACLE_SYM field_length opt_binary
+ | VARCHAR2_ORACLE_SYM field_length opt_binary_and_compression
{
$$.set(&type_handler_varchar, $2);
}
- | nvarchar field_length opt_bin_mod
+ | nvarchar field_length opt_compressed opt_bin_mod
{
$$.set(&type_handler_varchar, $2);
- bincmp_collation(national_charset_info, $3);
+ bincmp_collation(national_charset_info, $4);
}
- | VARBINARY field_length
+ | VARBINARY field_length opt_compressed
{
Lex->charset=&my_charset_bin;
$$.set(&type_handler_varchar, $2);
}
- | RAW_ORACLE_SYM field_length
+ | RAW_ORACLE_SYM field_length opt_compressed
{
Lex->charset= &my_charset_bin;
$$.set(&type_handler_varchar, $2);
@@ -6962,17 +6975,17 @@ field_type_temporal:
field_type_lob:
- TINYBLOB
+ TINYBLOB opt_compressed
{
Lex->charset=&my_charset_bin;
$$.set(&type_handler_tiny_blob);
}
- | BLOB_MARIADB_SYM opt_field_length
+ | BLOB_MARIADB_SYM opt_field_length opt_compressed
{
Lex->charset=&my_charset_bin;
$$.set(&type_handler_blob, $2);
}
- | BLOB_ORACLE_SYM opt_field_length
+ | BLOB_ORACLE_SYM opt_field_length opt_compressed
{
Lex->charset=&my_charset_bin;
$$.set(&type_handler_long_blob);
@@ -6988,36 +7001,36 @@ field_type_lob:
sym_group_geom.needed_define));
#endif
}
- | MEDIUMBLOB
+ | MEDIUMBLOB opt_compressed
{
Lex->charset=&my_charset_bin;
$$.set(&type_handler_medium_blob);
}
- | LONGBLOB
+ | LONGBLOB opt_compressed
{
Lex->charset=&my_charset_bin;
$$.set(&type_handler_long_blob);
}
- | LONG_SYM VARBINARY
+ | LONG_SYM VARBINARY opt_compressed
{
Lex->charset=&my_charset_bin;
$$.set(&type_handler_medium_blob);
}
- | LONG_SYM varchar opt_binary
+ | LONG_SYM varchar opt_binary_and_compression
{ $$.set(&type_handler_medium_blob); }
- | TINYTEXT opt_binary
+ | TINYTEXT opt_binary_and_compression
{ $$.set(&type_handler_tiny_blob); }
- | TEXT_SYM opt_field_length opt_binary
+ | TEXT_SYM opt_field_length opt_binary_and_compression
{ $$.set(&type_handler_blob, $2); }
- | MEDIUMTEXT opt_binary
+ | MEDIUMTEXT opt_binary_and_compression
{ $$.set(&type_handler_medium_blob); }
- | LONGTEXT opt_binary
+ | LONGTEXT opt_binary_and_compression
{ $$.set(&type_handler_long_blob); }
- | CLOB_ORACLE_SYM opt_binary
+ | CLOB_ORACLE_SYM opt_binary_and_compression
{ $$.set(&type_handler_long_blob); }
- | LONG_SYM opt_binary
+ | LONG_SYM opt_binary_and_compression
{ $$.set(&type_handler_medium_blob); }
- | JSON_SYM
+ | JSON_SYM opt_compressed
{
Lex->charset= &my_charset_utf8mb4_bin;
$$.set(&type_handler_long_blob);
@@ -7157,13 +7170,9 @@ opt_precision:
| precision { $$= $1; }
;
-opt_attribute:
- /* empty */ {}
- | opt_attribute_list {}
- ;
-opt_attribute_list:
- opt_attribute_list attribute {}
+attribute_list:
+ attribute_list attribute {}
| attribute
;
@@ -7191,11 +7200,6 @@ attribute:
$2->name,Lex->charset->csname));
Lex->last_field->charset= $2;
}
- | COMPRESSED_SYM opt_compression_method
- {
- if (unlikely(Lex->last_field->set_compressed($2)))
- MYSQL_YYABORT;
- }
| serial_attribute
;
@@ -7204,6 +7208,36 @@ opt_compression_method:
| equal ident { $$= $2.str; }
;
+opt_compressed:
+ /* empty */ {}
+ | compressed { }
+ ;
+
+compressed:
+ COMPRESSED_SYM opt_compression_method
+ {
+ if (unlikely(Lex->last_field->set_compressed($2)))
+ MYSQL_YYABORT;
+ }
+ ;
+
+compressed_deprecated_data_type_attribute:
+ COMPRESSED_SYM opt_compression_method
+ {
+ if (unlikely(Lex->last_field->set_compressed_deprecated(thd, $2)))
+ MYSQL_YYABORT;
+ }
+ ;
+
+compressed_deprecated_column_attribute:
+ COMPRESSED_SYM opt_compression_method
+ {
+ if (unlikely(Lex->last_field->
+ set_compressed_deprecated_column_attribute(thd, $1.pos(), $2)))
+ MYSQL_YYABORT;
+ }
+ ;
+
asrow_attribute:
not NULL_SYM
{
@@ -7375,7 +7409,11 @@ charset_or_alias:
opt_binary:
/* empty */ { bincmp_collation(NULL, false); }
- | BYTE_SYM { bincmp_collation(&my_charset_bin, false); }
+ | binary {}
+ ;
+
+binary:
+ BYTE_SYM { bincmp_collation(&my_charset_bin, false); }
| charset_or_alias opt_bin_mod { bincmp_collation($1, $2); }
| BINARY { bincmp_collation(NULL, true); }
| BINARY charset_or_alias { bincmp_collation($2, true); }
@@ -15648,6 +15686,7 @@ keyword_label:
| keyword_sp_var_and_label
| keyword_sysvar_type
| FUNCTION_SYM
+ | COMPRESSED_SYM
;
keyword_sysvar_name:
@@ -15717,6 +15756,7 @@ keyword_sp_var_not_label:
| COLUMN_DELETE_SYM
| COLUMN_GET_SYM
| COMMENT_SYM
+ | COMPRESSED_SYM
| DEALLOCATE_SYM
| EXAMINED_SYM
| EXCLUDE_SYM
@@ -15929,7 +15969,6 @@ keyword_sp_var_and_label:
| COMMITTED_SYM
| COMPACT_SYM
| COMPLETION_SYM
- | COMPRESSED_SYM
| CONCURRENT
| CONNECTION_SYM
| CONSISTENT_SYM