From: | Peter Smith <smithpb2250(at)gmail(dot)com> |
---|---|
To: | PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
Subject: | DOCS: ALTER PUBLICATION - Synopsis for DROP is a bit misleading |
Date: | 2025-06-26 05:17:00 |
Message-ID: | CAHut+PsPu+47Q7b0o6h1r-qSt90U3zgbAHMHUag5o5E1Lo+=uw@mail.gmail.com |
Views: | Whole Thread | Raw Message | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
I noticed that the ALTER PUBLICATION synopsis is misleading for the DROP part.
CURRENTLY [1]
----------
ALTER PUBLICATION name ADD publication_object [, ...]
ALTER PUBLICATION name SET publication_object [, ...]
ALTER PUBLICATION name DROP publication_object [, ...]
...
where publication_object is one of:
TABLE [ ONLY ] table_name [ * ] [ ( column_name [, ... ] ) ] [
WHERE ( expression ) ] [, ... ]
TABLES IN SCHEMA { schema_name | CURRENT_SCHEMA } [, ... ]
----------
But
- You cannot specify a column list when doing ALTER PUBLICATION ...
DROP TABLE ...
- You cannot specify a WHERE clause when doing ALTER PUBLICATION ...
DROP TABLE ...
test_pub=# CREATE TABLE T1(C1 INT,C2 INT);
CREATE TABLE
test_pub=# CREATE PUBLICATION P1 FOR TABLE T1(C1,C2);
CREATE PUBLICATION
test_pub=# ALTER PUBLICATION P1 DROP TABLE T1(C1,C2);
ERROR: column list must not be specified in ALTER PUBLICATION ... DROP
test_pub=# ALTER PUBLICATION P1 DROP TABLE T1 WHERE (C1=99);
ERROR: cannot use a WHERE clause when removing a table from a publication
======
It seemed misleading for the synopsis to imply something is allowed,
but then have qualifying notes in the description saying it is not
allowed, and then have errors at runtime for yet more things that are
not allowed that the qualifying notes neglected to mention.
Would it be better to make the synopsis more correct in the first place?
e.g. something like this...
SUGGESTION
----------
ALTER PUBLICATION name ADD publication_object [, ...]
ALTER PUBLICATION name SET publication_object [, ...]
ALTER PUBLICATION name DROP publication_drop_object [, ...]
...
where publication_object is one of:
TABLE [ ONLY ] table_name [ * ] [ ( column_name [, ... ] ) ] [
WHERE ( expression ) ] [, ... ]
TABLES IN SCHEMA { schema_name | CURRENT_SCHEMA } [, ... ]
where publication_drop_object is one of:
TABLE [ ONLY ] table_name [ * ] [, ... ]
TABLES IN SCHEMA { schema_name | CURRENT_SCHEMA } [, ... ]
----------
Thoughts?
Attached is a patch that does the same.
~~~
Alternatively, if people feel the synopsis is OK as-is, then I feel
that at least we have to put more qualifications in the description to
say that column lists must not be specified when using DROP.
======
[1] https://www.postgresql.org/docs/devel/sql-alterpublication.html
Kind Regards,
Peter Smith.
Fujitsu Australia
Attachment | Content-Type | Size |
---|---|---|
alter_publication_synopsis_drop.diff | application/octet-stream | 2.6 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Bertrand Drouvot | 2025-06-26 05:28:22 | Re: pgsql: Introduce pg_shmem_allocations_numa view |
Previous Message | Zhou, Zhiguo | 2025-06-26 05:07:49 | Optimize LWLock scalability via ReadBiasedLWLock for heavily-shared locks |