psql: Improve describe footer titles for publications.

The psql describe (`\d`) footer titles were previously unintuitive when
listing publications that included or excluded specific tables. Even
though the tag for included publications was pre-existing, it is better
to update it to "Included in publications:" to match the phrasing of
the "Excluded from publications:" tag.

Footer titles for sequence and schema descriptions have been updated
similarly to maintain consistency.

Reported-by: Álvaro Herrera <alvherre@kurilemu.de>
Author: Peter Smith <smithpb2250@gmail.com>
Reviewed-by: Amit Kapila <amit.kapila16@gmail.com>
Reviewed-by: vignesh C <vignesh21@gmail.com>
Reviewed-by: Yuchen Li <liyuchen_xyz@163.com>
Discussion: https://postgr.es/m/aeDs7iZUox1bbKAK%40alvherre.pgsql
This commit is contained in:
Amit Kapila 2026-04-23 14:10:03 +05:30
parent 71123a5454
commit 2e1d4fdb10
5 changed files with 39 additions and 28 deletions

View file

@ -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>

View file

@ -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));
@ -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++)
@ -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++)

View file

@ -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;

View file

@ -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;
@ -201,7 +210,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 +259,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 +444,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 +453,7 @@ Except publications:
--------+---------+-----------+----------+---------
a | integer | | |
Partition key: RANGE (a)
Except publications:
Excluded from publications:
"testpub8"
Number of partitions: 1 (Use \d+ to list them.)
@ -479,7 +488,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 +507,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"
@ -636,7 +645,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 +673,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 +687,7 @@ RESET client_min_messages;
--------+---------+-----------+----------+---------
a | integer | | |
b | text | | |
Publications:
Included in publications:
"testpub_rf_no"
"testpub_rf_yes" WHERE (a > 1)
@ -1153,7 +1162,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 +1178,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 +1194,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 +1332,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 +1549,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 +1562,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 +1590,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:

View file

@ -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;