RE: Added schema level support for publication.

From: "houzj(dot)fnst(at)fujitsu(dot)com" <houzj(dot)fnst(at)fujitsu(dot)com>
To: vignesh C <vignesh21(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>, "tanghy(dot)fnst(at)fujitsu(dot)com" <tanghy(dot)fnst(at)fujitsu(dot)com>, Greg Nancarrow <gregn4422(at)gmail(dot)com>, Ajin Cherian <itsajin(at)gmail(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>, Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com>
Subject: RE: Added schema level support for publication.
Date: 2021-09-01 01:28:38
Message-ID: OS3PR01MB57180DBA8FF9BC897960AA8D94CD9@OS3PR01MB5718.jpnprd01.prod.outlook.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

From Mon, Aug 30, 2021 11:26 PM vignesh C <vignesh21(at)gmail(dot)com> wrote:
> On Mon, Aug 30, 2021 at 9:10 AM houzj(dot)fnst(at)fujitsu(dot)com <houzj(dot)fnst(at)fujitsu(dot)com> wrote:
> >
> > 5)
> > + if (list_length(pubobj->name) == 1 &&
> > + (strcmp(relname, "CURRENT_SCHEMA") ==
> 0))
> > + ereport(ERROR,
> > +
> errcode(ERRCODE_SYNTAX_ERROR),
> > + errmsg("invalid relation
> name at or near"),
> > +
> > + parser_errposition(pstate, pubobj->location));
> >
> > Maybe we don't need this check, because it will report an error in
> > OpenTableList() anyway, "relation "CURRENT_SCHEMA" does not exist" ,
> > and that message seems readable to me.
>
> Allowing CURRENT_SCHEMA is required to support current schema for schema
> publications, currently I'm allowing this syntax during parsing and this error is
> thrown for relations later, this is done to keep the similar error as earlier before
> this feature support. I felt we can keep it like this to maintain the similar error.
> Thoughts?

Thanks for the explanation, I got the point.

Here are some other comments for v23-000x patches.

1)

@@ -6225,6 +6342,9 @@ describePublications(const char *pattern)
bool has_pubtruncate;
bool has_pubviaroot;

+ PQExpBufferData title;
+ printTableContent cont;
+
if (pset.sversion < 100000)
{
...
PQExpBufferData title;
printTableOpt myopt = pset.popt.topt;
printTableContent cont;

Should we delete the inner declaration of 'title' and 'cont' ?

2)
- /* parameters used for ALTER PUBLICATION ... ADD/DROP TABLE */
+ /* parameters used for ALTER PUBLICATION ... ADD/DROP TABLE/SCHEMA */

SCHEMA => ALL TABLES IN SCHEMA

3)

+ .description = "PUBLICATION SCHEMA",
+ .section = SECTION_POST_DATA,
+ .createStmt = query->data));

Is it better to use something like 'PUBLICATION TABLES IN SCHEMA' to describe
the schema level table publication ? Because there could be some other type
publication such as 'ALL SEQUENCES IN SCHEMA' in the future, it will be better
to make it clear that we only publish table in schema in this patch.

Best regards,
Hou zj

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2021-09-01 01:33:15 Re: pgstat_send_connstats() introduces unnecessary timestamp and UDP overhead
Previous Message Masahiko Sawada 2021-09-01 01:05:18 Re: Replication slot drop message is sent after pgstats shutdown.