public inbox for [email protected]  
help / color / mirror / Atom feed
From: Peter Smith <[email protected]>
To: Amit Kapila <[email protected]>
Cc: Álvaro Herrera <[email protected]>
Cc: PostgreSQL Hackers <[email protected]>
Subject: Re: EXCEPT TABLE - Case inconsistency for describe \d and \dRp+
Date: Mon, 20 Apr 2026 12:56:40 +1000
Message-ID: <CAHut+Puic9YTrdj3B4BX1J-m=EJTtF5bhxk8cJpKJVrw6QWMLA@mail.gmail.com> (raw)
In-Reply-To: <CAA4eK1LKQTHkVWdrS9vBfiaAf5kVuU-qOx_FD2u1F4zB9hz4PA@mail.gmail.com>
References: <CAHut+Pt3t_tCYwDStkj5fG4Z=YXrHvPBA7iGdh745QipC5zKeg@mail.gmail.com>
	<[email protected]>
	<CAHut+Psq7qmQSQCZA_HZcFv9ADCHDUPqCyFuTKfPDU-GUGihhQ@mail.gmail.com>
	<CAA4eK1LKQTHkVWdrS9vBfiaAf5kVuU-qOx_FD2u1F4zB9hz4PA@mail.gmail.com>

On Fri, Apr 17, 2026 at 3:24 PM Amit Kapila <[email protected]> wrote:
>
> On Fri, Apr 17, 2026 at 4:34 AM Peter Smith <[email protected]> wrote:
> >
> > On Fri, Apr 17, 2026 at 12:10 AM Álvaro Herrera <[email protected]> wrote:
> > >
> > > On 2026-Apr-10, Peter Smith wrote:
> > >
> > > > # -- describe the tables
> > > > # \d t1
> > > >                 Table "public.t1"
> > > > Column | Type   | Collation | Nullable | Default
> > > > --------+---------+-----------+----------+---------
> > > > a      | integer |           |          |
> > > > Except Publications:
> > > >   "pub1"
> > >
> > > I have a hard time understanding what an "except publication" is.  I
> > > think this would be clearer if the header said "Excluded from publications:"
> > >
> >
> > I agree that your suggestion is clearer.
> >
> > If we make that change, then should the "Publications:" footer also be
> > modified similarly (to "Included in publications:") so they match?
> >
> > e.g.
> >
> > CURRENTLY
> >
> > test_pub=# \d t1
> >                  Table "public.t1"
> >  Column |  Type   | Collation | Nullable | Default
> > --------+---------+-----------+----------+---------
> >  a      | integer |           |          |
> > Publications:
> >     "pub1"
> >     "pub2"
> > Except publications:
> >     "pub3"
> >
> > ~~~
> >
> > SUGGESTION
> >
> > test_pub=# \d t1
> >                  Table "public.t1"
> >  Column |  Type   | Collation | Nullable | Default
> > --------+---------+-----------+----------+---------
> >  a      | integer |           |          |
> > Included in publications:
> >     "pub1"
> >     "pub2"
> > Excluded from publications:
> >     "pub3"
> >
> > ~~~
> >
>
> +1 for the proposal. It makes the description clear.
>

PSA  v3 patches.

v3-0001 - Fixed the TABLE describe footer titles as suggested.
- "Included in publications:"
- "Excluded from publications:"

v3-0002 - Made similar footer title changes for SEQUENCE describe

v3-0003 - Made similar footer title changes for SHCEMA describe. In
passing, I found that this \dn describe output was not even being
tested, so I added the missing regression test.

======
Kind Regards,
Peter Smith.
Fujitsu Australia.


Attachments:

  [application/octet-stream] v3-0001-Fix-footer-titles-for-TABLE-describe.patch (8.0K, 2-v3-0001-Fix-footer-titles-for-TABLE-describe.patch)
  download | inline diff:
From 8678152b07ce7b8b19fb8c7be045acad6c03fd3c Mon Sep 17 00:00:00 2001
From: Peter Smith <[email protected]>
Date: Mon, 20 Apr 2026 12:22:38 +1000
Subject: [PATCH v3] Fix footer titles for TABLE describe

---
 doc/src/sgml/logical-replication.sgml     |  8 +++---
 src/bin/psql/describe.c                   |  4 +--
 src/test/regress/expected/alter_table.out |  2 +-
 src/test/regress/expected/publication.out | 30 +++++++++++------------
 4 files changed, 22 insertions(+), 22 deletions(-)

diff --git a/doc/src/sgml/logical-replication.sgml b/doc/src/sgml/logical-replication.sgml
index 598e23ad4f5..c06d255d2ed 100644
--- a/doc/src/sgml/logical-replication.sgml
+++ b/doc/src/sgml/logical-replication.sgml
@@ -1099,7 +1099,7 @@ Tables:
  c      | text    |           | not null |
 Indexes:
     "t1_pkey" PRIMARY KEY, btree (a, c)
-Publications:
+Included in publications:
     "p1" WHERE ((a > 5) AND (c = 'NSW'::text))
     "p2"
 
@@ -1112,7 +1112,7 @@ Publications:
  f      | integer |           |          |
 Indexes:
     "t2_pkey" PRIMARY KEY, btree (d)
-Publications:
+Included in publications:
     "p2" WHERE (e = 99)
     "p3" WHERE (d = 10)
 
@@ -1125,7 +1125,7 @@ Publications:
  i      | integer |           |          |
 Indexes:
     "t3_pkey" PRIMARY KEY, btree (g)
-Publications:
+Included in publications:
     "p3" WHERE (g = 10)
 ]]></programlisting></para>
 
@@ -1526,7 +1526,7 @@ Tables:
  e      | text    |           |          |
 Indexes:
     "t1_pkey" PRIMARY KEY, btree (id)
-Publications:
+Included in publications:
     "p1" (id, a, b, d)
 </programlisting></para>
 
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index dd1179ef927..b315159bcb3 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3263,7 +3263,7 @@ describeOneTableDetails(const char *schemaname,
 				tuples = PQntuples(result);
 
 			if (tuples > 0)
-				printTableAddFooter(&cont, _("Publications:"));
+				printTableAddFooter(&cont, _("Included in publications:"));
 
 			/* Might be an empty set - that's ok */
 			for (i = 0; i < tuples; i++)
@@ -3306,7 +3306,7 @@ describeOneTableDetails(const char *schemaname,
 				tuples = PQntuples(result);
 
 			if (tuples > 0)
-				printTableAddFooter(&cont, _("Except publications:"));
+				printTableAddFooter(&cont, _("Excluded from publications:"));
 
 			/* Might be an empty set - that's ok */
 			for (i = 0; i < tuples; i++)
diff --git a/src/test/regress/expected/alter_table.out b/src/test/regress/expected/alter_table.out
index dad9d36937e..6dd22be0e8d 100644
--- a/src/test/regress/expected/alter_table.out
+++ b/src/test/regress/expected/alter_table.out
@@ -4868,7 +4868,7 @@ alter table alter1.t1 set schema alter2;
  Column |  Type   | Collation | Nullable | Default | Storage | Stats target | Description 
 --------+---------+-----------+----------+---------+---------+--------------+-------------
  a      | integer |           |          |         | plain   |              | 
-Publications:
+Included in publications:
     "pub1"
 
 drop publication pub1;
diff --git a/src/test/regress/expected/publication.out b/src/test/regress/expected/publication.out
index d028e9be866..eb635147644 100644
--- a/src/test/regress/expected/publication.out
+++ b/src/test/regress/expected/publication.out
@@ -201,7 +201,7 @@ SELECT pubname, puballtables FROM pg_publication WHERE pubname = 'testpub_forall
  data   | text    |           |          |                                          | extended |              | 
 Indexes:
     "testpub_tbl2_pkey" PRIMARY KEY, btree (id)
-Publications:
+Included in publications:
     "testpub_foralltables"
 Not-null constraints:
     "testpub_tbl2_id_not_null" NOT NULL "id"
@@ -250,9 +250,9 @@ Except tables:
  data   | text    |           |          | 
 Indexes:
     "testpub_tbl1_pkey" PRIMARY KEY, btree (id)
-Publications:
+Included in publications:
     "testpub_foralltables"
-Except publications:
+Excluded from publications:
     "testpub_foralltables_excepttable"
     "testpub_foralltables_excepttable1"
 
@@ -435,7 +435,7 @@ Except tables:
 --------+---------+-----------+----------+---------
  a      | integer |           |          | 
 Partition of: testpub_root FOR VALUES FROM (0) TO (100)
-Except publications:
+Excluded from publications:
     "testpub8"
 
 \d testpub_root
@@ -444,7 +444,7 @@ Except publications:
 --------+---------+-----------+----------+---------
  a      | integer |           |          | 
 Partition key: RANGE (a)
-Except publications:
+Excluded from publications:
     "testpub8"
 Number of partitions: 1 (Use \d+ to list them.)
 
@@ -636,7 +636,7 @@ Tables:
  Column |  Type   | Collation | Nullable | Default 
 --------+---------+-----------+----------+---------
  e      | integer |           |          | 
-Publications:
+Included in publications:
     "testpub5" WHERE ((e > 1000) AND (e < 2000))
 
 ALTER PUBLICATION testpub5 DROP TABLE testpub_rf_tbl2;
@@ -664,7 +664,7 @@ Tables:
  Column |  Type   | Collation | Nullable | Default 
 --------+---------+-----------+----------+---------
  e      | integer |           |          | 
-Publications:
+Included in publications:
     "testpub5" WHERE ((e > 300) AND (e < 500))
 
 -- test \d <tablename> (now it displays filter information)
@@ -678,7 +678,7 @@ RESET client_min_messages;
 --------+---------+-----------+----------+---------
  a      | integer |           |          | 
  b      | text    |           |          | 
-Publications:
+Included in publications:
     "testpub_rf_no"
     "testpub_rf_yes" WHERE (a > 1)
 
@@ -1153,7 +1153,7 @@ ALTER PUBLICATION testpub_fortable ADD TABLE testpub_tbl7 (a, b);
  c      | text    |           |          |         | extended |              | 
 Indexes:
     "testpub_tbl7_pkey" PRIMARY KEY, btree (a)
-Publications:
+Included in publications:
     "testpub_fortable" (a, b)
 Not-null constraints:
     "testpub_tbl7_a_not_null" NOT NULL "a"
@@ -1169,7 +1169,7 @@ ALTER PUBLICATION testpub_fortable SET TABLE testpub_tbl7 (a, b);
  c      | text    |           |          |         | extended |              | 
 Indexes:
     "testpub_tbl7_pkey" PRIMARY KEY, btree (a)
-Publications:
+Included in publications:
     "testpub_fortable" (a, b)
 Not-null constraints:
     "testpub_tbl7_a_not_null" NOT NULL "a"
@@ -1185,7 +1185,7 @@ ALTER PUBLICATION testpub_fortable SET TABLE testpub_tbl7 (a, c);
  c      | text    |           |          |         | extended |              | 
 Indexes:
     "testpub_tbl7_pkey" PRIMARY KEY, btree (a)
-Publications:
+Included in publications:
     "testpub_fortable" (a, c)
 Not-null constraints:
     "testpub_tbl7_a_not_null" NOT NULL "a"
@@ -1323,7 +1323,7 @@ Tables:
  c      | integer |           | not null |         | plain   |              | 
 Indexes:
     "testpub_tbl_both_filters_pkey" PRIMARY KEY, btree (a, c) REPLICA IDENTITY
-Publications:
+Included in publications:
     "testpub_both_filters" (a, c) WHERE (c <> 1)
 Not-null constraints:
     "testpub_tbl_both_filters_a_not_null" NOT NULL "a"
@@ -1540,7 +1540,7 @@ ALTER PUBLICATION testpub_ins_trunct ADD TABLE pub_test.testpub_nopk, testpub_tb
 --------+---------+-----------+----------+---------+---------+--------------+-------------
  foo    | integer |           |          |         | plain   |              | 
  bar    | integer |           |          |         | plain   |              | 
-Publications:
+Included in publications:
     "testpub_default"
     "testpub_fortbl"
     "testpub_ins_trunct"
@@ -1553,7 +1553,7 @@ Publications:
  data   | text    |           |          |                                          | extended |              | 
 Indexes:
     "testpub_tbl1_pkey" PRIMARY KEY, btree (id)
-Publications:
+Included in publications:
     "testpub_default"
     "testpub_fortbl"
     "testpub_ins_trunct"
@@ -1581,7 +1581,7 @@ ERROR:  relation "testpub_nopk" is not part of the publication
  data   | text    |           |          |                                          | extended |              | 
 Indexes:
     "testpub_tbl1_pkey" PRIMARY KEY, btree (id)
-Publications:
+Included in publications:
     "testpub_fortbl"
     "testpub_ins_trunct"
 Not-null constraints:
-- 
2.47.3



  [application/octet-stream] v3-0003-Fix-footer-titles-for-SCHEMA-describe.patch (2.7K, 3-v3-0003-Fix-footer-titles-for-SCHEMA-describe.patch)
  download | inline diff:
From 50536524004025de6428ad8321860273f71bee24 Mon Sep 17 00:00:00 2001
From: Peter Smith <[email protected]>
Date: Mon, 20 Apr 2026 12:50:58 +1000
Subject: [PATCH v3] Fix footer titles for SCHEMA describe

In passing, add a missing \dn describe test.
---
 src/bin/psql/describe.c                   | 6 +++---
 src/test/regress/expected/publication.out | 9 +++++++++
 src/test/regress/sql/publication.sql      | 2 ++
 3 files changed, 14 insertions(+), 3 deletions(-)

diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index a58598d82a9..49228117eb6 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -5533,11 +5533,11 @@ listSchemas(const char *pattern, bool verbose, bool showSystem)
 		{
 			/*
 			 * Allocate memory for footers. Size of footers will be 1 (for
-			 * storing "Publications:" string) + publication schema mapping
-			 * count +  1 (for storing NULL).
+			 * storing "Included in publications:" string) + publication
+			 * schema mapping count +  1 (for storing NULL).
 			 */
 			footers = pg_malloc_array(char *, 1 + pub_schema_tuples + 1);
-			footers[0] = pg_strdup(_("Publications:"));
+			footers[0] = pg_strdup(_("Included in publications:"));
 
 			/* Might be an empty set - that's ok */
 			for (i = 0; i < pub_schema_tuples; i++)
diff --git a/src/test/regress/expected/publication.out b/src/test/regress/expected/publication.out
index 8d9eb57ed1a..0345f6c5e47 100644
--- a/src/test/regress/expected/publication.out
+++ b/src/test/regress/expected/publication.out
@@ -128,6 +128,15 @@ Tables from schemas:
 
 SET client_min_messages = 'ERROR';
 CREATE PUBLICATION testpub_forschema FOR TABLES IN SCHEMA pub_test;
+\dn pub_test
+           List of schemas
+   Name   |          Owner           
+----------+--------------------------
+ pub_test | regress_publication_user
+Included in publications:
+    "testpub_forschema"
+    "testpub_fortable"
+
 -- should be able to create publication with schema and table of the same
 -- schema
 CREATE PUBLICATION testpub_for_tbl_schema FOR TABLES IN SCHEMA pub_test, TABLE pub_test.testpub_nopk;
diff --git a/src/test/regress/sql/publication.sql b/src/test/regress/sql/publication.sql
index 642e32fa098..041e14a4de6 100644
--- a/src/test/regress/sql/publication.sql
+++ b/src/test/regress/sql/publication.sql
@@ -76,6 +76,8 @@ ALTER PUBLICATION testpub_fortable SET TABLES IN SCHEMA pub_test;
 
 SET client_min_messages = 'ERROR';
 CREATE PUBLICATION testpub_forschema FOR TABLES IN SCHEMA pub_test;
+\dn pub_test
+
 -- should be able to create publication with schema and table of the same
 -- schema
 CREATE PUBLICATION testpub_for_tbl_schema FOR TABLES IN SCHEMA pub_test, TABLE pub_test.testpub_nopk;
-- 
2.47.3



  [application/octet-stream] v3-0002-Fix-footer-titles-for-SEQUENCE-describe.patch (1.9K, 4-v3-0002-Fix-footer-titles-for-SEQUENCE-describe.patch)
  download | inline diff:
From cbb5ae8309963de2b2e003cfcc6c6fa761d4f133 Mon Sep 17 00:00:00 2001
From: Peter Smith <[email protected]>
Date: Mon, 20 Apr 2026 12:33:23 +1000
Subject: [PATCH v3] Fix footer titles for SEQUENCE describe

---
 src/bin/psql/describe.c                   | 2 +-
 src/test/regress/expected/publication.out | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index b315159bcb3..a58598d82a9 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -1895,7 +1895,7 @@ describeOneTableDetails(const char *schemaname,
 
 				if (nrows > 0)
 				{
-					printfPQExpBuffer(&tmpbuf, _("Publications:"));
+					printfPQExpBuffer(&tmpbuf, _("Included in publications:"));
 					for (i = 0; i < nrows; i++)
 						appendPQExpBuffer(&tmpbuf, "\n    \"%s\"", PQgetvalue(result, i, 0));
 
diff --git a/src/test/regress/expected/publication.out b/src/test/regress/expected/publication.out
index eb635147644..8d9eb57ed1a 100644
--- a/src/test/regress/expected/publication.out
+++ b/src/test/regress/expected/publication.out
@@ -479,7 +479,7 @@ SELECT pubname, puballtables, puballsequences FROM pg_publication WHERE pubname
   Type  | Start | Minimum |       Maximum       | Increment | Cycles? | Cache 
 --------+-------+---------+---------------------+-----------+---------+-------
  bigint |     1 |       1 | 9223372036854775807 |         1 | no      |     1
-Publications:
+Included in publications:
     "regress_pub_forallsequences1"
 
 \dRp+ regress_pub_forallsequences1
@@ -498,7 +498,7 @@ RESET client_min_messages;
   Type  | Start | Minimum |       Maximum       | Increment | Cycles? | Cache 
 --------+-------+---------+---------------------+-----------+---------+-------
  bigint |     1 |       1 | 9223372036854775807 |         1 | no      |     1
-Publications:
+Included in publications:
     "regress_pub_forallsequences1"
     "regress_pub_forallsequences2"
 
-- 
2.47.3



view thread (19+ messages)  latest in thread

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: [email protected]
  Cc: [email protected], [email protected], [email protected], [email protected]
  Subject: Re: EXCEPT TABLE - Case inconsistency for describe \d and \dRp+
  In-Reply-To: <CAHut+Puic9YTrdj3B4BX1J-m=EJTtF5bhxk8cJpKJVrw6QWMLA@mail.gmail.com>

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

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