pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: David Rowley <drowley@postgresql.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Improve ALTER PUBLICATION validation and error messages
Date: Thu, 15 Aug 2024 01:11:07 +0000
Message-ID: <E1seP19-004Cd6-9F@gemulon.postgresql.org> (raw)

Improve ALTER PUBLICATION validation and error messages

Attempting to add a system column for a table to an existing publication
would result in the not very intuitive error message of:

ERROR:  negative bitmapset member not allowed

Here we improve that to have it display the same error message as a user
would see if they tried adding a system column for a table when adding
it to the publication in the first place.

Doing this requires making the function which validates the list of
columns an extern function.  The signature of the static function wasn't
an ideal external API as it made the code more complex than it needed to be.
Here we adjust the function to have it populate a Bitmapset of attribute
numbers.  Doing it this way allows code simplification.

There was no particular bug here other than the weird error message, so
no backpatch.

Bug: #18558
Reported-by: Alexander Lakhin <exclusion@gmail.com>
Author: Peter Smith, David Rowley
Discussion: https://postgr.es/m/18558-411bc81b03592125@postgresql.org

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/80ffcb842748f0b8ccf8b24c5c3b2500755d2dcd

Modified Files
--------------
src/backend/catalog/pg_publication.c      | 110 +++++++++++++-----------------
src/backend/commands/publicationcmds.c    |  22 ++----
src/backend/commands/subscriptioncmds.c   |   2 +-
src/include/catalog/pg_publication.h      |   1 +
src/test/regress/expected/publication.out |   7 ++
src/test/regress/sql/publication.sql      |   4 ++
6 files changed, 66 insertions(+), 80 deletions(-)



Message-ID: <E1seP19-004Cd6-9F@gemulon.postgresql.org>
Permalink:  ../E1seP19-004Cd6-9F@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1seP19-004Cd6-9F@gemulon.postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-committers@postgresql.org
  Cc: drowley@postgresql.org, pgsql-committers@lists.postgresql.org
  Subject: Re: pgsql: Improve ALTER PUBLICATION validation and error messages
  In-Reply-To: <E1seP19-004Cd6-9F@gemulon.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox