summaryrefslogtreecommitdiff
path: root/sql/sql_yacc_ora.yy
diff options
context:
space:
mode:
authorAlexander Barkov <bar@mariadb.com>2018-10-04 18:38:01 +0400
committerAlexander Barkov <bar@mariadb.com>2018-10-04 18:40:43 +0400
commitd7b293be87431a3293543372394d214913fd6615 (patch)
tree68d52bcce41943e0b248d16f70970834e6921a6f /sql/sql_yacc_ora.yy
parent941ca92a2ca3990020b23bcc92e7ca98dcc8f814 (diff)
downloadmariadb-git-d7b293be87431a3293543372394d214913fd6615.tar.gz
MDEV-17374 Shift/reduce conflicts because of SOUNDS_SYM, ESCAPE_SYM, USER_SYM not given precedence
Diffstat (limited to 'sql/sql_yacc_ora.yy')
-rw-r--r--sql/sql_yacc_ora.yy26
1 files changed, 20 insertions, 6 deletions
diff --git a/sql/sql_yacc_ora.yy b/sql/sql_yacc_ora.yy
index ecbf4f3aa28..97245259fec 100644
--- a/sql/sql_yacc_ora.yy
+++ b/sql/sql_yacc_ora.yy
@@ -282,10 +282,10 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize);
%parse-param { THD *thd }
%lex-param { THD *thd }
/*
- Currently there are 63 shift/reduce conflicts.
+ Currently there are 57 shift/reduce conflicts.
We should not introduce new conflicts any more.
*/
-%expect 63
+%expect 57
/*
Comments for TOKENS.
@@ -1044,6 +1044,16 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize);
%left JOIN_SYM INNER_SYM STRAIGHT_JOIN CROSS LEFT RIGHT
/* A dummy token to force the priority of table_ref production in a join. */
%left TABLE_REF_PRIORITY
+
+/*
+ Give ESCAPE (in LIKE) a very low precedence.
+ This allows the concatenation operator || to be used on the right
+ side of "LIKE" with sql_mode=PIPES_AS_CONCAT (without ORACLE):
+ SELECT 'ab' LIKE 'a'||'b'||'c';
+*/
+%left PREC_BELOW_ESCAPE
+%left ESCAPE_SYM
+
%left SET_VAR
%left OR_SYM OR2_SYM
%left XOR
@@ -1053,7 +1063,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize);
%left NOT_SYM
%left BETWEEN_SYM CASE_SYM WHEN_SYM THEN_SYM ELSE
-%left '=' EQUAL_SYM GE '>' LE '<' NE IS LIKE REGEXP IN_SYM
+%left '=' EQUAL_SYM GE '>' LE '<' NE IS LIKE SOUNDS_SYM REGEXP IN_SYM
%left '|'
%left '&'
%left SHIFT_LEFT SHIFT_RIGHT
@@ -1085,6 +1095,10 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize);
SELECT system FROM t1;
ALTER TABLE DROP SYSTEM VERSIONIONG;
+ - USER: identifier, user:
+ SELECT user FROM t1;
+ KILL USER foo;
+
Note, we need here only tokens that cause shirt/reduce conflicts
with keyword identifiers. For example:
opt_clause1: %empty | KEYWORD ... ;
@@ -1123,7 +1137,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize);
and until NEXT_SYM / PREVIOUS_SYM.
*/
%left PREC_BELOW_IDENTIFIER_OPT_SPECIAL_CASE
-%left TRANSACTION_SYM TIMESTAMP PERIOD_SYM SYSTEM
+%left TRANSACTION_SYM TIMESTAMP PERIOD_SYM SYSTEM USER
/*
@@ -12404,7 +12418,7 @@ opt_escape:
Lex->escape_used= TRUE;
$$= $2;
}
- | /* empty */
+ | /* empty */ %prec PREC_BELOW_ESCAPE
{
Lex->escape_used= FALSE;
$$= ((thd->variables.sql_mode & MODE_NO_BACKSLASH_ESCAPES) ?
@@ -16108,7 +16122,7 @@ keyword_sp_var_and_label:
| UNDOFILE_SYM
| UNKNOWN_SYM
| UNTIL_SYM
- | USER_SYM
+ | USER_SYM %prec PREC_BELOW_CONTRACTION_TOKEN2
| USE_FRM
| VARIABLES
| VIEW_SYM