You've already forked mariadb-columnstore-engine
mirror of
https://github.com/mariadb-corporation/mariadb-columnstore-engine.git
synced 2025-07-30 19:23:07 +03:00
MCOL-1384 Backport the MCOL-573 feature to 1.1. Change msg type to avoid server code assert violation.
This commit is contained in:
committed by
Roman Nozdrin
parent
12f2e112e2
commit
efbf297eb7
@ -32,7 +32,7 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
using namespace ddlpackage;
|
using namespace ddlpackage;
|
||||||
typedef enum { NOOP, STRIP_QUOTES, STRIP_QUOTES_FQ } copy_action_t;
|
typedef enum { NOOP, STRIP_QUOTES } copy_action_t;
|
||||||
int lineno = 1;
|
int lineno = 1;
|
||||||
void ddlerror(struct pass_to_bison* x, char const *s);
|
void ddlerror(struct pass_to_bison* x, char const *s);
|
||||||
|
|
||||||
@ -72,8 +72,6 @@ identifier {ident_start}{ident_cont}*
|
|||||||
fq_identifier {identifier}\.{identifier}
|
fq_identifier {identifier}\.{identifier}
|
||||||
identifier_quoted {grave_accent}{identifier}{grave_accent}
|
identifier_quoted {grave_accent}{identifier}{grave_accent}
|
||||||
identifier_double_quoted {double_quote}{identifier}{double_quote}
|
identifier_double_quoted {double_quote}{identifier}{double_quote}
|
||||||
fq_quoted ({identifier_quoted}|{identifier})\.({identifier_quoted}|{identifier})
|
|
||||||
fq_double_quoted ({identifier_double_quoted}|{identifier})\.({identifier_double_quoted}|{identifier})
|
|
||||||
|
|
||||||
integer [-+]?{digit}+
|
integer [-+]?{digit}+
|
||||||
decimal ([-+]?({digit}*\.{digit}+)|({digit}+\.{digit}*))
|
decimal ([-+]?({digit}*\.{digit}+)|({digit}+\.{digit}*))
|
||||||
@ -87,9 +85,6 @@ realfail2 ({integer}|{decimal})[Ee][-+]
|
|||||||
|
|
||||||
{identifier_quoted} { ddlget_lval(yyscanner)->str = scanner_copy( ddlget_text(yyscanner), yyscanner, STRIP_QUOTES ); return IDENT; }
|
{identifier_quoted} { ddlget_lval(yyscanner)->str = scanner_copy( ddlget_text(yyscanner), yyscanner, STRIP_QUOTES ); return IDENT; }
|
||||||
{identifier_double_quoted} { ddlget_lval(yyscanner)->str = scanner_copy( ddlget_text(yyscanner), yyscanner, STRIP_QUOTES ); return DQ_IDENT; }
|
{identifier_double_quoted} { ddlget_lval(yyscanner)->str = scanner_copy( ddlget_text(yyscanner), yyscanner, STRIP_QUOTES ); return DQ_IDENT; }
|
||||||
{fq_identifier} { ddlget_lval(yyscanner)->str = scanner_copy(ddlget_text(yyscanner), yyscanner); return FQ_IDENT; }
|
|
||||||
{fq_quoted} { ddlget_lval(yyscanner)->str = scanner_copy(ddlget_text(yyscanner), yyscanner, STRIP_QUOTES_FQ); return FQ_IDENT; }
|
|
||||||
{fq_double_quoted} { ddlget_lval(yyscanner)->str = scanner_copy(ddlget_text(yyscanner), yyscanner, STRIP_QUOTES_FQ); return FQ_IDENT; }
|
|
||||||
|
|
||||||
ACTION {return ACTION;}
|
ACTION {return ACTION;}
|
||||||
ADD {return ADD;}
|
ADD {return ADD;}
|
||||||
@ -195,7 +190,7 @@ LONGTEXT {return LONGTEXT;}
|
|||||||
}
|
}
|
||||||
|
|
||||||
{grave_accent} {
|
{grave_accent} {
|
||||||
/* ignore */
|
return ddlget_text(yyscanner)[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
%%
|
%%
|
||||||
@ -273,7 +268,6 @@ char* scanner_copy (char *str, yyscan_t yyscanner, copy_action_t action)
|
|||||||
char* result;
|
char* result;
|
||||||
char* nv = strdup(str);
|
char* nv = strdup(str);
|
||||||
result = nv;
|
result = nv;
|
||||||
|
|
||||||
// free strduped memory later to prevent possible memory leak
|
// free strduped memory later to prevent possible memory leak
|
||||||
if(nv)
|
if(nv)
|
||||||
((scan_data*)ddlget_extra(yyscanner))->valbuf.push_back(nv);
|
((scan_data*)ddlget_extra(yyscanner))->valbuf.push_back(nv);
|
||||||
@ -283,57 +277,6 @@ char* scanner_copy (char *str, yyscan_t yyscanner, copy_action_t action)
|
|||||||
nv[strlen(str) - 1] = '\0';
|
nv[strlen(str) - 1] = '\0';
|
||||||
result = nv + 1;
|
result = nv + 1;
|
||||||
}
|
}
|
||||||
else if (action == STRIP_QUOTES_FQ)
|
|
||||||
{
|
|
||||||
bool move_left = false;
|
|
||||||
bool move_right = false;
|
|
||||||
char* left = nv;
|
|
||||||
char* tmp_first = nv;
|
|
||||||
// MCOL-1384 Loop through all comas in this quoted fq id
|
|
||||||
// looking for $quote_sign.$quote_sign sequence.
|
|
||||||
char* fq_delimiter;
|
|
||||||
int tmp_pos = 0;
|
|
||||||
while((fq_delimiter = strchr(tmp_first, '.')) != NULL)
|
|
||||||
{
|
|
||||||
if( (*(fq_delimiter -1) == '`' && *(fq_delimiter + 1) == '`') ||
|
|
||||||
(*(fq_delimiter -1) == '"' && *(fq_delimiter + 1) == '"') )
|
|
||||||
{
|
|
||||||
tmp_pos += fq_delimiter - tmp_first;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
tmp_first = fq_delimiter;
|
|
||||||
}
|
|
||||||
|
|
||||||
char* fq_delimiter_orig = str + tmp_pos;
|
|
||||||
char* right = fq_delimiter + 1;
|
|
||||||
char* right_orig = fq_delimiter_orig + 1;
|
|
||||||
// MCOL-1384 Strip quotes from the left part.
|
|
||||||
if(*left == '"' || *left == '`')
|
|
||||||
{
|
|
||||||
result = left + 1;
|
|
||||||
*(fq_delimiter - 1) = '.';
|
|
||||||
move_left = true;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
fq_delimiter += 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
int right_length = strlen(right);
|
|
||||||
// MCOL-1384 Strip quotes from the right part.
|
|
||||||
if(*right == '`' || *right == '"')
|
|
||||||
{
|
|
||||||
right += 1; right_orig += 1;
|
|
||||||
right_length -= 2;
|
|
||||||
move_right = true;
|
|
||||||
*(fq_delimiter + right_length) = '\0';
|
|
||||||
}
|
|
||||||
|
|
||||||
if(move_left || move_right)
|
|
||||||
{
|
|
||||||
strncpy(fq_delimiter, right_orig, right_length);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@ -41,7 +41,6 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
%{
|
%{
|
||||||
#include "string.h"
|
|
||||||
#include "sqlparser.h"
|
#include "sqlparser.h"
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
@ -115,7 +114,7 @@ REFERENCES RENAME RESTRICT SET SMALLINT TABLE TEXT TIME TINYBLOB TINYTEXT
|
|||||||
TINYINT TO UNIQUE UNSIGNED UPDATE USER SESSION_USER SYSTEM_USER VARCHAR VARBINARY
|
TINYINT TO UNIQUE UNSIGNED UPDATE USER SESSION_USER SYSTEM_USER VARCHAR VARBINARY
|
||||||
VARYING WITH ZONE DOUBLE IDB_FLOAT REAL CHARSET IDB_IF EXISTS CHANGE TRUNCATE
|
VARYING WITH ZONE DOUBLE IDB_FLOAT REAL CHARSET IDB_IF EXISTS CHANGE TRUNCATE
|
||||||
|
|
||||||
%token <str> DQ_IDENT FQ_IDENT IDENT FCONST SCONST CP_SEARCH_CONDITION_TEXT ICONST DATE
|
%token <str> DQ_IDENT IDENT FCONST SCONST CP_SEARCH_CONDITION_TEXT ICONST DATE
|
||||||
|
|
||||||
/* Notes:
|
/* Notes:
|
||||||
* 1. "ata" stands for alter_table_action
|
* 1. "ata" stands for alter_table_action
|
||||||
@ -606,26 +605,13 @@ table_name:
|
|||||||
;
|
;
|
||||||
|
|
||||||
qualified_name:
|
qualified_name:
|
||||||
FQ_IDENT {
|
|
||||||
char* delimeterPosition = strchr(const_cast<char*>($1), '.');
|
|
||||||
if( delimeterPosition )
|
|
||||||
{
|
|
||||||
*delimeterPosition = '\0';
|
|
||||||
char* schemaName = const_cast<char*>($1);
|
|
||||||
char* tableName = delimeterPosition + 1;
|
|
||||||
$$ = new QualifiedName(schemaName, tableName);
|
|
||||||
*delimeterPosition = '.';
|
|
||||||
}
|
|
||||||
else
|
|
||||||
$$ = new QualifiedName($1);
|
|
||||||
}
|
|
||||||
| ident {
|
| ident {
|
||||||
if (x->fDBSchema.size())
|
if (x->fDBSchema.size())
|
||||||
$$ = new QualifiedName((char*)x->fDBSchema.c_str(), $1);
|
$$ = new QualifiedName((char*)x->fDBSchema.c_str(), $1);
|
||||||
else
|
else
|
||||||
$$ = new QualifiedName($1);
|
$$ = new QualifiedName($1);
|
||||||
}
|
}
|
||||||
| IDENT '.' IDENT
|
| ident '.' ident
|
||||||
{
|
{
|
||||||
$$ = new QualifiedName($1, $3);
|
$$ = new QualifiedName($1, $3);
|
||||||
}
|
}
|
||||||
|
@ -2083,7 +2083,7 @@ int ha_calpont_impl_rename_table_(const char* from, const char* to, cal_connecti
|
|||||||
int rc = ProcessDDLStatement(stmt, db, "", tid2sid(thd->thread_id), emsg);
|
int rc = ProcessDDLStatement(stmt, db, "", tid2sid(thd->thread_id), emsg);
|
||||||
|
|
||||||
if (rc != 0)
|
if (rc != 0)
|
||||||
push_warning(thd, Sql_condition::WARN_LEVEL_ERROR, 9999, emsg.c_str());
|
push_warning(thd, Sql_condition::WARN_LEVEL_WARN, 9999, emsg.c_str());
|
||||||
|
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
@ -2123,7 +2123,7 @@ long long calonlinealter(UDF_INIT* initid, UDF_ARGS* args,
|
|||||||
|
|
||||||
int rc = ProcessDDLStatement(stmt, db, "", tid2sid(thd->thread_id), emsg, compressiontype);
|
int rc = ProcessDDLStatement(stmt, db, "", tid2sid(thd->thread_id), emsg, compressiontype);
|
||||||
if (rc != 0)
|
if (rc != 0)
|
||||||
push_warning(thd, Sql_condition::WARN_LEVEL_ERROR, 9999, emsg.c_str());
|
push_warning(thd, Sql_condition::WARN_LEVEL_WARN, 9999, emsg.c_str());
|
||||||
|
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user