On Wednesday, September 22, 2021 11:22 AM Masahiko Sawada <sawada.mshk@gmail.com> wrote:
>
> ---
> + if (!IsA(node, String))
> + ereport(ERROR,
> + errcode(ERRCODE_SYNTAX_ERROR),
> + errmsg("invalid schema
> name at or near"),
> +
> parser_errposition(pstate, pubobj->location));
>
> The error message should mention where the invalid schema name is at
> or near. Also, In the following example, the error position in the
> error message seems not to be where the invalid schemaname s.s is:
>
> postgres(1:47707)=# create publication p for all tables in schema s.s;
> ERROR: invalid schema name at or near
> LINE 1: create publication p for all tables in schema s.s;
> ^
>
I noticed this, too. And I think it could be fixed by the following change, thoughts?
--- a/src/backend/parser/gram.y
+++ b/src/backend/parser/gram.y
@@ -9681,7 +9681,7 @@ PublicationObjSpec: TABLE pubobj_expr
{
$$ = $5;
$$->pubobjtype = PUBLICATIONOBJ_REL_IN_SCHEMA;
- $$->location = @1;
+ $$->location = @5;
}
| pubobj_expr
{
Besides, about this change in tab-complete.c:
+ else if (Matches("ALTER", "PUBLICATION", MatchAny, "ADD|DROP|SET", "SCHEMA"))
+ COMPLETE_WITH_QUERY(Query_for_list_of_schemas
+ " UNION SELECT 'CURRENT_SCHEMA'");
It should be "ALL TABLES IN SCHEMA" not "SCHEMA" at the first line, right?
Regards
Tang