RE: Added schema level support for publication.

From: "tanghy(dot)fnst(at)fujitsu(dot)com" <tanghy(dot)fnst(at)fujitsu(dot)com>
To: vignesh C <vignesh21(at)gmail(dot)com>, Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>, Peter Smith <smithpb2250(at)gmail(dot)com>, Peter Eisentraut <peter(dot)eisentraut(at)enterprisedb(dot)com>, Greg Nancarrow <gregn4422(at)gmail(dot)com>, Ajin Cherian <itsajin(at)gmail(dot)com>, "houzj(dot)fnst(at)fujitsu(dot)com" <houzj(dot)fnst(at)fujitsu(dot)com>, Rahila Syed <rahilasyed90(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Bharath Rupireddy <bharath(dot)rupireddyforpostgres(at)gmail(dot)com>
Subject: RE: Added schema level support for publication.
Date: 2021-08-30 08:01:05
Message-ID: OS0PR01MB61135AD9523243C4F4A32B38FBCB9@OS0PR01MB6113.jpnprd01.prod.outlook.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Friday, August 27, 2021 2:13 PM vignesh C <vignesh21(at)gmail(dot)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

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.

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".

Regards
Tang

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Eisentraut 2021-08-30 08:17:30 Re: Some RELKIND macro refactoring
Previous Message Rajkumar Raghuwanshi 2021-08-30 07:51:21 Re: Multi-Column List Partitioning