Re: Added schema level support for publication.

vignesh C <vignesh21@gmail.com>

From: vignesh C <vignesh21@gmail.com>
To: "tanghy.fnst@fujitsu.com" <tanghy.fnst@fujitsu.com>
Cc: Masahiko Sawada <sawada.mshk@gmail.com>, Tom Lane <tgl@sss.pgh.pa.us>, Amit Kapila <amit.kapila16@gmail.com>, Peter Smith <smithpb2250@gmail.com>, Peter Eisentraut <peter.eisentraut@enterprisedb.com>, Greg Nancarrow <gregn4422@gmail.com>, Ajin Cherian <itsajin@gmail.com>, "houzj.fnst@fujitsu.com" <houzj.fnst@fujitsu.com>, Rahila Syed <rahilasyed90@gmail.com>, PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>, Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com>
Date: 2021-08-30T15:28:02Z
Lists: pgsql-hackers
On Mon, Aug 30, 2021 at 1:31 PM tanghy.fnst@fujitsu.com
<tanghy.fnst@fujitsu.com> wrote:
>
> On Friday, August 27, 2021 2:13 PM vignesh C <vignesh21@gmail.com> wrote:
> >
> > I have implemented this in the 0003 patch, I have kept it separate to
> > reduce the testing effort and also it will be easier if someone
> > disagrees with the syntax. I will merge it to the main patch later
> > based on the feedback. Attached v22 patch has the changes for the
> > same.
> > Thoughts?
> >
>
> Thanks for your new patch. Here are some suggestions:
>
> 1.
> If a publication published a table and the schema where the table belonged to, the
> publication name would show twice when using '\d+' for the table.
> Maybe we should add some check to avoid the duplication. Thought?
>
> For example:
>
> create schema sch1;
> create table sch1.tbl(a int);
> create publication pub for table sch1.tbl, all tables in schema sch1;
>
> postgres=# \d+ sch1.tbl
>                                             Table "sch1.tbl"
>  Column |  Type   | Collation | Nullable | Default | Storage | Compression | Stats target | Description
> --------+---------+-----------+----------+---------+---------+-------------+--------------+-------------
>  a      | integer |           |          |         | plain   |             |              |
> Publications:
>     "pub"
>     "pub"
> Access method: heap

Modified

> 2. doc/src/sgml/catalogs.sgml
> @@ -6169,6 +6174,7 @@ SCRAM-SHA-256$<replaceable>&lt;iteration count&gt;</replaceable>:<replaceable>&l
>         publication instead of its own.
>        </para></entry>
>       </row>
> +
>      </tbody>
>     </tgroup>
>    </table>
>
> It seems that we don't need this change.

Modified

> 3. src/bin/psql/tab-complete.c
>
> +       /* Complete "CREATE PUBLICATION <name> FOR SCHEMA <schema>, ..." */
> +       else if (HeadMatches("CREATE", "PUBLICATION", MatchAny, "FOR", "ALL", "TABLES", "IN", "SCHEMA"))
> +               COMPLETE_WITH_QUERY(Query_for_list_of_schemas
> +                                                       " UNION SELECT 'CURRENT_SCHEMA' "
> +                                                       "UNION SELECT 'WITH ('");
>
> The comment should be updated to "FOR ALL TABLES IN SCHEMA".

Modified.

I have fixed these comments as part of v23 patch attached at [1].
[1] - https://www.postgresql.org/message-id/CALDaNm0xmqJeQEfV5Wnj2BawM%3DsdFdfOXz5N%2BgGG3WB6k9%3Dtdw%40mail.gmail.com

Regards,
Vignesh



Commits

  1. Include schema/table publications even with exclude options in dump.

  2. Rename some enums to use TABLE instead of REL.

  3. Add tap tests for the schema publications.

  4. Allow publishing the tables of schema.

  5. In pg_dump, use simplehash.h to look up dumpable objects by OID.