RE: Added schema level support for publication.
tanghy.fnst@fujitsu.com <tanghy.fnst@fujitsu.com>
From: "tanghy.fnst@fujitsu.com" <tanghy.fnst@fujitsu.com>
To: Masahiko Sawada <sawada.mshk@gmail.com>, vignesh C <vignesh21@gmail.com>
Cc: Amit Kapila <amit.kapila16@gmail.com>, "houzj.fnst@fujitsu.com" <houzj.fnst@fujitsu.com>, Peter Eisentraut <peter.eisentraut@enterprisedb.com>, Tom Lane <tgl@sss.pgh.pa.us>, Peter
Smith <smithpb2250@gmail.com>, Greg Nancarrow <gregn4422@gmail.com>, Ajin
Cherian <itsajin@gmail.com>, Rahila Syed <rahilasyed90@gmail.com>, PostgreSQL
Hackers <pgsql-hackers@lists.postgresql.org>, Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com>
Date: 2021-09-22T05:57:29Z
Lists: pgsql-hackers
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
Commits
-
Include schema/table publications even with exclude options in dump.
- 4aa6fa3cd0a2 18.0 landed
-
Rename some enums to use TABLE instead of REL.
- b3812d0b9bcf 15.0 landed
-
Add tap tests for the schema publications.
- 6b0f6f79eef2 15.0 landed
-
Allow publishing the tables of schema.
- 5a2832465fd8 15.0 landed
-
In pg_dump, use simplehash.h to look up dumpable objects by OID.
- 92316a4582a5 15.0 cited