From 01fd5d0d0e527ed5da5d6d2dcf91f74162bb4ad1 Mon Sep 17 00:00:00 2001 From: Gleb Shchepa Date: Mon, 23 Jun 2014 19:59:15 +0400 Subject: Bug #18978946: BACKPORT TO 5.6: BUGFIX FOR 18017820 "BISON 3 BREAKS MYSQL BUILD" Backport of the fix: : Bug 18017820: BISON 3 BREAKS MYSQL BUILD : ======================================== : : The source of the reported problem is a removal of a few deprecated : things from Bison 3.x: : * YYPARSE_PARAM macro (use the %parse-param bison directive instead), : * YYLEX_PARAM macro (use %lex-param instead), : : The fix removes obsolete macro calls and introduces use of : %parse-param and %lex-param directives. --- sql/sql_yacc.yy | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) (limited to 'sql/sql_yacc.yy') diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index 3af964db731..bd5d4dc5604 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -22,13 +22,9 @@ */ %{ -/* thd is passed as an argument to yyparse(), and subsequently to yylex(). -** The type will be void*, so it must be cast to (THD*) when used. -** Use the YYTHD macro for this. +/* +Note: YYTHD is passed as an argument to yyparse(), and subsequently to yylex(). */ -#define YYPARSE_PARAM yythd -#define YYLEX_PARAM yythd -#define YYTHD ((THD *)yythd) #define YYLIP (& YYTHD->m_parser_state->m_lip) #define YYPS (& YYTHD->m_parser_state->m_yacc) @@ -76,7 +72,7 @@ int yylex(void *yylval, void *yythd); ulong val= *(F); \ if (my_yyoverflow((B), (D), &val)) \ { \ - yyerror((char*) (A)); \ + yyerror(YYTHD, (char*) (A)); \ return 2; \ } \ else \ @@ -174,10 +170,8 @@ void my_parse_error(const char *s) to abort from the parser. */ -void MYSQLerror(const char *s) +void MYSQLerror(THD *thd, const char *s) { - THD *thd= current_thd; - /* Restore the original LEX if it was replaced when parsing a stored procedure. We must ensure that a parsing error @@ -787,7 +781,9 @@ static bool add_create_index (LEX *lex, Key::Keytype type, bool my_yyoverflow(short **a, YYSTYPE **b, ulong *yystacksize); %} -%pure_parser /* We have threads */ +%parse-param { class THD *YYTHD } +%lex-param { class THD *YYTHD } +%pure-parser /* We have threads */ /* Currently there are 168 shift/reduce conflicts. We should not introduce new conflicts any more. -- cgit v1.2.1 From cdf72d51c631aecb46505ff94cdb9ef667d4444c Mon Sep 17 00:00:00 2001 From: Raghav Kapoor Date: Wed, 25 Jun 2014 18:06:28 +0530 Subject: BUG#17665767 - FAILING ASSERTION: PRIMARY_KEY_NO == -1 || PRIMARY_KEY_NO == 0 BACKGROUND: This bug is a followup on Bug#16368875. The assertion failure happens because in SQL layer the key does not get promoted to PRIMARY KEY but InnoDB takes it as PRIMARY KEY. ANALYSIS: Here we are trying to create an index on POINT (GEOMETRY) data type which is a type of BLOB (since GEOMETRY is a subclass of BLOB). In general, we can't create an index over GEOMETRY family type field unless we specify the length of the keypart (similar to BLOB fields). Only exception is the POINT field type. The POINT column max size is 25. The problem is that the field is not treated as PRIMARY KEY when we create a index on POINT column using its max column size as key part prefix. The fix would allow index on POINT column to be treated as PRIMARY KEY. FIX: Patch for Bug#16368875 is extended to take into account GEOMETRY datatype, POINT in particular to consider it as PRIMARY KEY in SQL layer. --- sql/sql_yacc.yy | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'sql/sql_yacc.yy') diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index bd5d4dc5604..74a21c9f6b6 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -5603,7 +5603,8 @@ spatial_type: | GEOMETRYCOLLECTION { $$= Field::GEOM_GEOMETRYCOLLECTION; } | POINT_SYM { - Lex->length= (char*)"25"; + Lex->length= const_cast(STRINGIFY_ARG + (MAX_LEN_GEOM_POINT_FIELD)); $$= Field::GEOM_POINT; } | MULTIPOINT { $$= Field::GEOM_MULTIPOINT; } -- cgit v1.2.1