On Tue, Sep 28, 2021 at 4:35 PM tanghy.fnst@fujitsu.com
<tanghy.fnst@fujitsu.com> wrote:
>
> On Monday, September 27, 2021 1:32 PM, vignesh C <vignesh21@gmail.com> wrote:
>
> >Attached v33 patch has the preprocess_pubobj_list review comment fix
> >suggested by Alvaro at [1]. The
> >v33-0006-Alternate-grammar-for-ALL-TABLES-IN-SCHEMA.patch patch has
> >the grammar changes as suggested by Alvaro at [1]. If we agree this is
> >better, I will merge this into the 0001 patch.
> >[1] - https://www.postgresql.org/message-id/202109241325.eag5g6mpvoup%40alvherre.pgsql
>
> About the schema patch, I think a schema and a table which belongs to this schema shouldn't be specified at the same
time.
> But what if someone uses "ALTER TABLE ... SET SCHEMA ..." after "CREATE PUBLICATION"?
>
> For example:
>
> create schema sch1;
> create schema sch2;
> create table sch2.t (a int);
> create publication pub1 for all tables in schema sch1, table sch2.t; alter table sch2.t set schema sch1;
>
> postgres=# \dRp+
> Publication pub1
> Owner | All tables | Inserts | Updates | Deletes | Truncates | Via root
> ----------+------------+---------+---------+---------+-----------+------
> ----------+------------+---------+---------+---------+-----------+----
> postgres | f | t | t | t | t | f
> Tables:
> "sch1.t"
> Tables from schemas:
> "sch1"
>
> Table t has been output twice.
> I think this should not be supported, should we do something for this scenario?
Yes this should not be supported, we should throw an error in this case.
This is handled in the v34 patch attached at [1].
[1] - https://www.postgresql.org/message-id/CALDaNm2Z9TfuoCf09YGKfwy7F1NwC4iCXJGTaZS%3DchH6VHtadQ%40mail.gmail.com
Regards,
Vignesh