RE: Added schema level support for publication.
Zhijie Hou (Fujitsu) <houzj.fnst@fujitsu.com>
From: "houzj.fnst@fujitsu.com" <houzj.fnst@fujitsu.com>
To: vignesh C <vignesh21@gmail.com>, Amit Kapila <amit.kapila16@gmail.com>
Cc: Masahiko Sawada <sawada.mshk@gmail.com>, Peter Eisentraut <peter.eisentraut@enterprisedb.com>, Tom Lane <tgl@sss.pgh.pa.us>, Peter
Smith <smithpb2250@gmail.com>, "tanghy.fnst@fujitsu.com" <tanghy.fnst@fujitsu.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>, "houzj.fnst@fujitsu.com" <houzj.fnst@fujitsu.com>
Date: 2021-09-10T03:23:56Z
Lists: pgsql-hackers
Attachments
- refactor-with-flag_patch (application/octet-stream)
- refactor-without-flag_patch (application/octet-stream)
From Friday, September 10, 2021 10:33 AM Hou Zhijie<houzj.fnst@fujitsu.com> wrote:
> From Wed, Sept 8, 2021 7:44 PM vignesh C <vignesh21@gmail.com> wrote:
> > Modified
> > Thanks for the comments, the attached v26 patch has the changes for the
> same.
>
> Hi,
>
> Thanks for updating the patch, I have a suggestion for the gram.y.
>
> Currently, we have the following two members in PublicationObjSpec to
> distinguish
> between names of different objects for the post-analysis phase.
>
> >bool inh;
> >bool spl_rel_type_syn;
>
> I was thinking do we have another way to distinguish that which can make code
> smaller. I tried serval approaches and found a possible better approach.
>
> First, I refer to the design of Grant/Revoke syntax, it use two members
> 'targtype' and 'objtype' to mark different type. 'targtype' can be
> ACL_TARGET_OBJECT(single target) or ACL_TARGET_ALL_IN_SCHEMA(schema
> level)
> .'objtype' is the actual type which can be OBJECT_SEQUENCE or OBJECT_TABLE
> or
> ... . I think if we follow this way, the code could be cleaner.
>
> Second, we can move the special relation expression into a separate rule
> 'speical_relation_expr' like the following, this can remove duplicate code
> used by pubobj_expr.
> ------
> relation_expr:
> qualified_name
> {}
> | speical_relation_expr
> {
> $$ = $1;
> }
> ;
> speical_relation_expr:
> qualified_name '*'
> {}
> | ONLY qualified_name
> {}
> | ONLY '(' qualified_name ')'
> {}
> ;
> ------
>
> Finally, the gram.y will look like the following.
> Personally, the code looks cleaner in this approach.
Besides, If we don't want to use a new flag to distinguish tablename and schemaname,
We can only check the NodeTag to distinguish the difference.
Attach two diff patches based on the latest schema patch
which change the code with a flag and without a flag.
Best regards,
Hou zj
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