!6659 修正 CREATE USER 语法解析报错信息

Merge pull request !6659 from Celestial/fix_gram_create_user
This commit is contained in:
opengauss_bot
2024-11-13 12:14:27 +00:00
committed by Gitee
2 changed files with 3 additions and 3 deletions

View File

@ -1785,7 +1785,7 @@ UserId:
| SCONST
{
if (u_sess->attr.attr_sql.sql_compatibility != B_FORMAT || !u_sess->attr.attr_common.b_compatibility_user_host_auth)
ereport(ERROR, (errcode(ERRCODE_SYNTAX_ERROR), errmsg("syntax error at or near \"%s\"", $1), parser_errposition(@1)));
ereport(ERROR, (errcode(ERRCODE_SYNTAX_ERROR), errmsg("syntax error at or near \"'%s'\"", $1), parser_errposition(@1)));
if (strchr($1,'@'))
ereport(ERROR,(errcode(ERRCODE_INVALID_NAME),errmsg("@ can't be allowed in username")));
if (strlen($1) >= NAMEDATALEN) {

View File

@ -25,7 +25,7 @@ ERROR: user@host is only supported in b database when the b_compatibility_user_
create user 'test_user_host'@'127.0.%' password 'test123@';
ERROR: user@host is only supported in b database when the b_compatibility_user_host_auth is on
create user 'test_user_host%' password 'test123@';
ERROR: syntax error at or near "test_user_host%"
ERROR: syntax error at or near "'test_user_host%'"
LINE 1: create user 'test_user_host%' password 'test123@';
^
create user 'test_user_host'@'127.0.0.1' password 'test123@';
@ -42,7 +42,7 @@ ERROR: user@host is only supported in b database when the b_compatibility_user_
create user 'test_user_host'@'127.0.%' password 'test123@';
ERROR: user@host is only supported in b database when the b_compatibility_user_host_auth is on
create user 'test_user_host%' password 'test123@';
ERROR: syntax error at or near "test_user_host%"
ERROR: syntax error at or near "'test_user_host%'"
LINE 1: create user 'test_user_host%' password 'test123@';
^
create user 'test_user_host'@'127.0.0.1' password 'test123@';