diff --git a/src/common/backend/parser/gram.y b/src/common/backend/parser/gram.y index 885fab1b5..fb6ce49cb 100644 --- a/src/common/backend/parser/gram.y +++ b/src/common/backend/parser/gram.y @@ -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) { diff --git a/src/test/regress/output/user_host_test.source b/src/test/regress/output/user_host_test.source index 15241eefe..81857d155 100644 --- a/src/test/regress/output/user_host_test.source +++ b/src/test/regress/output/user_host_test.source @@ -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@';