| From: | vignesh C <vignesh21(at)gmail(dot)com> |
|---|---|
| To: | Amit Kapila <amit(dot)kapila16(at)gmail(dot)com> |
| Cc: | Andrei Lepikhov <lepihov(at)gmail(dot)com>, shveta malik <shveta(dot)malik(at)gmail(dot)com>, Shlok Kyal <shlok(dot)kyal(dot)oss(at)gmail(dot)com>, Nisha Moond <nisha(dot)moond412(at)gmail(dot)com>, Ashutosh Sharma <ashu(dot)coek88(at)gmail(dot)com>, "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>, Dilip Kumar <dilipbalaut(at)gmail(dot)com>, Peter Smith <smithpb2250(at)gmail(dot)com>, "Zhijie Hou (Fujitsu)" <houzj(dot)fnst(at)fujitsu(dot)com>, YeXiu <1518981153(at)qq(dot)com>, Ian Lawrence Barwick <barwick(at)gmail(dot)com>, Bharath Rupireddy <bharath(dot)rupireddyforpostgres(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
| Subject: | Re: Skipping schema changes in publication |
| Date: | 2026-03-10 12:49:34 |
| Message-ID: | CALDaNm2h8GW6B8rohNMpi0D3UQ5rpnJTVmAjaVWsrAtavE17iw@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
On Tue, 10 Mar 2026 at 10:25, Amit Kapila <amit(dot)kapila16(at)gmail(dot)com> wrote:
>
> On Mon, Mar 9, 2026 at 4:23 PM vignesh C <vignesh21(at)gmail(dot)com> wrote:
> >
> > This is addressed in the v60 version patch attached.
> > Also Nisha's comments from [1] and Shveta's comments from [2] are
> > handled in the v60 version.
> >
>
> *
> + /* Check that user is allowed to manipulate the publication. */
> + if (excepttables && !pubform->puballtables)
> + ereport(ERROR,
> + errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
> + errmsg("publication \"%s\" is not defined as FOR ALL TABLES",
> + NameStr(pubform->pubname)),
> + errdetail("Except tables cannot be added to or dropped from
> publications that are not defined as FOR ALL TABLES."));
> +
> + /*
> + * SET ALL TABLES is allowed only for publications defined as FOR ALL
> + * TABLES.
> + */
> + if (stmt->action == AP_SetObjects && !pubform->puballtables &&
> + !tables && !excepttables && !schemaidlist)
> + ereport(ERROR,
> + errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
> + errmsg("publication \"%s\" is not defined as FOR ALL TABLES",
> + NameStr(pubform->pubname)));
> +
> + /* Only a superuser can add or remove EXCEPT tables */
> + if (stmt->action == AP_SetObjects &&
> + (excepttables || (!tables && !excepttables && !schemaidlist)) &&
> + !superuser())
> + ereport(ERROR,
> + errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
> + errmsg("must be superuser to add or drop except tables"));
>
> All the above checks are trying to drive the answer to whether the new
> Alter statement is for_all_tables via indirect checks. Why not keep
> for_all_tables boolean variable in AlterPublicationStmt similar to
> CreatePublicationStmt? That should simplify the above checks.
>
> * Also, the superuser check should be earlier in the code, say just
> after following existing check:
> if ((stmt->action == AP_AddObjects || stmt->action == AP_SetObjects) &&
> schemaidlist && !superuser())
> ereport(ERROR,
> (errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
> errmsg("must be superuser to add or set schemas")));
Thanks for the comments, these are addressed in the v61 version patch attached.
Regards,
Vignesh
| Attachment | Content-Type | Size |
|---|---|---|
| v61-0001-Add-support-for-EXCEPT-TABLE-in-ALTER-PUBLICATIO.patch | application/octet-stream | 27.2 KB |
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Tender Wang | 2026-03-10 12:59:22 | [PATCH] Simplify trivial shmem size calculations |
| Previous Message | Jet | 2026-03-10 12:44:46 | Re: Potential security risk associated with function call |