修复set 赋值反单引号``问题
This commit is contained in:
@ -886,6 +886,21 @@ other .
|
||||
char *slashstar = strstr(yytext, "/*");
|
||||
char *dashdash = strstr(yytext, "--");
|
||||
|
||||
if (u_sess->attr.attr_sql.sql_compatibility == B_FORMAT && u_sess->attr.attr_common.enable_set_variable_b_format)
|
||||
{
|
||||
if(nchars > 3 && yytext[0] == '@' && yytext[1] == '`' && yytext[nchars-1] == '`')
|
||||
{
|
||||
char *subtext = strstr(yytext + 2, "`");
|
||||
if(strlen(subtext) == 1)
|
||||
{
|
||||
SET_YYLLOC();
|
||||
yylval->str = pstrdup(yytext + 1);
|
||||
yyextra->is_hint_str = false;
|
||||
return SET_USER_IDENT;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (slashstar && dashdash)
|
||||
{
|
||||
/* if both appear, take the first one */
|
||||
|
@ -92,6 +92,9 @@ select @v1, @1a_b.2$3, @a_b.2$3, @_ab.2$3, @.ab_2$3, @$ab.2_3,
|
||||
@"v1", @"1a_b.2$3", @"a_b.2$3", @"_ab.2$3", @".ab_2$3", @"$ab.2_3",
|
||||
@`v1`, @`1a_b.2$3`, @`a_b.2$3`, @`_ab.2$3`, @`.ab_2$3`, @`$ab.2_3`;
|
||||
select @`gdas()^&?<>cs`, @"gdas()^&?<>cs", @'gdas()^&?<>cs';
|
||||
set @`!`:= 2;
|
||||
set @`~~!` := 3;
|
||||
select @`!`,@`~~!`;
|
||||
-- error
|
||||
select @gdas()^&?<>cs;
|
||||
|
||||
@ -546,4 +549,4 @@ drop database if exists test_set;
|
||||
\! @abs_bindir@/gs_guc reload -Z datanode -D @abs_srcdir@/tmp_check/datanode1 -c "enable_set_variable_b_format=off" >/dev/null 2>&1
|
||||
\! sleep 1
|
||||
|
||||
show enable_set_variable_b_format;
|
||||
show enable_set_variable_b_format;
|
||||
|
@ -171,6 +171,14 @@ select @`gdas()^&?<>cs`, @"gdas()^&?<>cs", @'gdas()^&?<>cs';
|
||||
7 | 7 | 7
|
||||
(1 row)
|
||||
|
||||
set @`!`:= 2;
|
||||
set @`~~!` := 3;
|
||||
select @`!`,@`~~!`;
|
||||
@! | @~~!
|
||||
----+------
|
||||
2 | 3
|
||||
(1 row)
|
||||
|
||||
-- error
|
||||
select @gdas()^&?<>cs;
|
||||
ERROR: syntax error at or near "("
|
||||
|
Reference in New Issue
Block a user