Thread
Commits
-
psql: Make \d+ inheritance tables list formatting consistent with other objects
- 1a11405a4360 19 (unreleased) landed
-
psql: Make \d+ partition list formatting consistent with other objects
- 7bff9f106a5e 19 (unreleased) landed
-
Fix how some lists are displayed by psql \d+
Peter Smith <smithpb2250@gmail.com> — 2026-01-08T22:47:19Z
Hi. I recently saw that the psql \d+ lists for "Partitions:" are not aligned in quite the same way as other lists ("Publications:" etc) because they use indents and line breaks differently. e.g. See below: test_pub=# \d+ part1 Partitioned table "public.part1" Column | Type | Collation | Nullable | Default | Storage | Compression | Stats target | Description --------+---------+-----------+----------+---------+---------+-------------+--------------+------------- a | integer | | | | plain | | | Partition of: t1 FOR VALUES FROM (0) TO (50) Partition constraint: ((a IS NOT NULL) AND (a >= 0) AND (a < 50)) Partition key: RANGE (a) Publications: "pub1" "pub2" "pub_only" Partitions: part1_1 FOR VALUES FROM (0) TO (25), PARTITIONED, part1_2 FOR VALUES FROM (25) TO (50) ~~~ PSA v1 0001 - Fix (common code) lists for "Partitions:" and "Child tables:" 0002 - Fix list for "Inherits:" in the same way ~~~ The *patched* result for the same example now looks like below. Notice that in passing I also removed the comma separators, which are not present in the other footer lists. test_pub=# \d+ part1 Partitioned table "public.part1" Column | Type | Collation | Nullable | Default | Storage | Compression | Stats target | Description --------+---------+-----------+----------+---------+---------+-------------+--------------+------------- a | integer | | | | plain | | | Partition of: t1 FOR VALUES FROM (0) TO (50) Partition constraint: ((a IS NOT NULL) AND (a >= 0) AND (a < 50)) Partition key: RANGE (a) Publications: "pub1" "pub2" "pub_only" Partitions: part1_1 FOR VALUES FROM (0) TO (25), PARTITIONED part1_2 FOR VALUES FROM (25) TO (50) ====== Kind Regards, Peter Smith. Fujitsu Australia -
Re: Fix how some lists are displayed by psql \d+
Chao Li <li.evan.chao@gmail.com> — 2026-01-09T00:45:36Z
> On Jan 9, 2026, at 06:47, Peter Smith <smithpb2250@gmail.com> wrote: > > Hi. > > I recently saw that the psql \d+ lists for "Partitions:" are not > aligned in quite the same way as other lists ("Publications:" etc) > because they use indents and line breaks differently. e.g. See below: > > test_pub=# \d+ part1 > Partitioned table "public.part1" > Column | Type | Collation | Nullable | Default | Storage | > Compression | Stats target | Description > --------+---------+-----------+----------+---------+---------+-------------+--------------+------------- > a | integer | | | | plain | > | | > Partition of: t1 FOR VALUES FROM (0) TO (50) > Partition constraint: ((a IS NOT NULL) AND (a >= 0) AND (a < 50)) > Partition key: RANGE (a) > Publications: > "pub1" > "pub2" > "pub_only" > Partitions: part1_1 FOR VALUES FROM (0) TO (25), PARTITIONED, > part1_2 FOR VALUES FROM (25) TO (50) > > ~~~ > > PSA v1 > 0001 - Fix (common code) lists for "Partitions:" and "Child tables:" > 0002 - Fix list for "Inherits:" in the same way > > ~~~ > > The *patched* result for the same example now looks like below. Notice > that in passing I also removed the comma separators, which are not > present in the other footer lists. > > test_pub=# \d+ part1 > Partitioned table "public.part1" > Column | Type | Collation | Nullable | Default | Storage | > Compression | Stats target | Description > --------+---------+-----------+----------+---------+---------+-------------+--------------+------------- > a | integer | | | | plain | > | | > Partition of: t1 FOR VALUES FROM (0) TO (50) > Partition constraint: ((a IS NOT NULL) AND (a >= 0) AND (a < 50)) > Partition key: RANGE (a) > Publications: > "pub1" > "pub2" > "pub_only" > Partitions: > part1_1 FOR VALUES FROM (0) TO (25), PARTITIONED > part1_2 FOR VALUES FROM (25) TO (50) > > ====== > Kind Regards, > Peter Smith. > Fujitsu Australia > <v1-0002-Fix-to-make-psql-d-lists-of-inherits-look-same-as.patch><v1-0001-Fix-to-make-psql-d-lists-of-partitions-look-same-.patch> This is a simple change, but makes sense to me, making the display looking better. The code change is straightforward and LGTM. Best regards, -- Chao Li (Evan) HighGo Software Co., Ltd. https://www.highgo.com/ -
Re: Fix how some lists are displayed by psql \d+
Neil Chen <carpenter.nail.cz@gmail.com> — 2026-01-09T01:19:28Z
Hi Peter, On Fri, Jan 9, 2026 at 6:47 AM Peter Smith <smithpb2250@gmail.com> wrote: > I recently saw that the psql \d+ lists for "Partitions:" are not > aligned in quite the same way as other lists ("Publications:" etc) > because they use indents and line breaks differently. e.g. See below: > > PSA v1 > 0001 - Fix (common code) lists for "Partitions:" and "Child tables:" > 0002 - Fix list for "Inherits:" in the same way > > This patch looks good to me. However, referring to the original code implementation, I believe the initial design intention for the psql display was to make it as "compact" as possible. I'm not sure.. if it's worthwhile to uniformly change the display style of other items you mentioned (such as Publications) to the compact style? -
Re: Fix how some lists are displayed by psql \d+
Peter Smith <smithpb2250@gmail.com> — 2026-01-09T01:54:33Z
On Fri, Jan 9, 2026 at 12:19 PM Neil Chen <carpenter.nail.cz@gmail.com> wrote: > ... > This patch looks good to me. > However, referring to the original code implementation, I believe the initial design intention for the psql display was to make it as "compact" as possible. > I'm not sure.. if it's worthwhile to uniformly change the display style of other items you mentioned (such as Publications) to the compact style? Hi Neil. Thanks for the review and the feedback. I assume the "compactness" you are referring to is where the first item was appearing on the same line as the list header "Partitions:". Yes, I did recognize and consider doing the same for all lists, but it seemed more work, and the end result would *still* have mis-aligned lists whenever there are multiple list types (because those list headers are of all different lengths so the indents are different). IMO that mis-alignment would still look messy just as the current HEAD does. TBH, I don't know if the primary goal of the \d+ is compactness, or readability. I chose readability. YMMV. There might be some middle ground, where lists having just a single item can appear on the same line as their list header. But, with lots of different kinds of lists, all that extra compacting logic seems overkill to me just for the sake of 1 or 2 fewer lines in the \d+ output. Again, that's why I chose the KISS approach. Waiting for other opinions. ====== Kind Regards, Peter Smith. Fujitsu Australia
-
Re: Fix how some lists are displayed by psql \d+
Greg Sabino Mullane <htamfids@gmail.com> — 2026-01-09T14:40:24Z
Patch looks good to me, and +1 for consistency and readability versus saving a newline (but adding commas!) Cheers, Greg
-
Re: Fix how some lists are displayed by psql \d+
Peter Smith <smithpb2250@gmail.com> — 2026-01-20T22:24:57Z
Ping. This small patch had received a couple of LGTM, but then the thread went silent for nearly 2 weeks. I've created a new CF entry [1] marked "ready for committer". Is there anything else I can do to help get this one over the line? ====== [1] https://commitfest.postgresql.org/patch/6413/ Kind Regards, Peter Smith. Fujitsu Australia
-
Re: Fix how some lists are displayed by psql \d+
Peter Smith <smithpb2250@gmail.com> — 2026-01-21T02:58:08Z
A rebase was needed for some more test expected output changes. PSA v2. ====== Kind Regards, Peter Smith. Fujitsu Australia
-
Re: Fix how some lists are displayed by psql \d+
Chao Li <li.evan.chao@gmail.com> — 2026-01-21T08:04:34Z
> On Jan 21, 2026, at 10:58, Peter Smith <smithpb2250@gmail.com> wrote: > > A rebase was needed for some more test expected output changes. > > PSA v2. > > ====== > Kind Regards, > Peter Smith. > Fujitsu Australia > <v2-0002-Fix-to-make-psql-d-lists-of-inherits-look-same-as.patch><v2-0001-Fix-to-make-psql-d-lists-of-partitions-look-same-.patch> I still see some difference: ``` evantest=# \d+ p_test; Partitioned table "public.p_test" Column | Type | Collation | Nullable | Default | Storage | Compression | Stats target | Description ----------+---------+-----------+----------+---------+----------+-------------+--------------+------------- id | integer | | | | plain | | | username | text | | | | extended | | | category | text | | | | extended | | | Partition key: LIST (category) Indexes: "idx_p_test_id" btree (id) Partitions: p_test_v1 FOR VALUES IN ('A') p_test_v2 FOR VALUES IN ('B') ``` The index name is quoted, but the partition names are not. Best regards, -- Chao Li (Evan) HighGo Software Co., Ltd. https://www.highgo.com/ -
Re: Fix how some lists are displayed by psql \d+
Peter Smith <smithpb2250@gmail.com> — 2026-01-21T08:22:44Z
On Wed, Jan 21, 2026 at 7:05 PM Chao Li <li.evan.chao@gmail.com> wrote: > > > > > On Jan 21, 2026, at 10:58, Peter Smith <smithpb2250@gmail.com> wrote: > > > > A rebase was needed for some more test expected output changes. > > > > PSA v2. > > > > ====== > > Kind Regards, > > Peter Smith. > > Fujitsu Australia > > <v2-0002-Fix-to-make-psql-d-lists-of-inherits-look-same-as.patch><v2-0001-Fix-to-make-psql-d-lists-of-partitions-look-same-.patch> > > I still see some difference: > ``` > evantest=# \d+ p_test; > Partitioned table "public.p_test" > Column | Type | Collation | Nullable | Default | Storage | Compression | Stats target | Description > ----------+---------+-----------+----------+---------+----------+-------------+--------------+------------- > id | integer | | | | plain | | | > username | text | | | | extended | | | > category | text | | | | extended | | | > Partition key: LIST (category) > Indexes: > "idx_p_test_id" btree (id) > Partitions: > p_test_v1 FOR VALUES IN ('A') > p_test_v2 FOR VALUES IN ('B') > ``` > > The index name is quoted, but the partition names are not. > AFAICT Indexes are quoted Constraints are quoted Publications are also quoted Partitions are NOT quoted Inherits are NOT quoted ~ Please confirm --- So, you are expecting that Partitions and Child tables should also be quoted, so that everything looks the same? This is scope creep from the original intent of this thread, so I will look at doing this in a separate patch 0003. ====== Kind Regards Peter Smith. Fujitsu Australia -
Re: Fix how some lists are displayed by psql \d+
Chao Li <li.evan.chao@gmail.com> — 2026-01-21T08:30:12Z
> On Jan 21, 2026, at 16:22, Peter Smith <smithpb2250@gmail.com> wrote: > > On Wed, Jan 21, 2026 at 7:05 PM Chao Li <li.evan.chao@gmail.com> wrote: >> >> >> >>> On Jan 21, 2026, at 10:58, Peter Smith <smithpb2250@gmail.com> wrote: >>> >>> A rebase was needed for some more test expected output changes. >>> >>> PSA v2. >>> >>> ====== >>> Kind Regards, >>> Peter Smith. >>> Fujitsu Australia >>> <v2-0002-Fix-to-make-psql-d-lists-of-inherits-look-same-as.patch><v2-0001-Fix-to-make-psql-d-lists-of-partitions-look-same-.patch> >> >> I still see some difference: >> ``` >> evantest=# \d+ p_test; >> Partitioned table "public.p_test" >> Column | Type | Collation | Nullable | Default | Storage | Compression | Stats target | Description >> ----------+---------+-----------+----------+---------+----------+-------------+--------------+------------- >> id | integer | | | | plain | | | >> username | text | | | | extended | | | >> category | text | | | | extended | | | >> Partition key: LIST (category) >> Indexes: >> "idx_p_test_id" btree (id) >> Partitions: >> p_test_v1 FOR VALUES IN ('A') >> p_test_v2 FOR VALUES IN ('B') >> ``` >> >> The index name is quoted, but the partition names are not. >> > > AFAICT > Indexes are quoted > Constraints are quoted > Publications are also quoted > > Partitions are NOT quoted > Inherits are NOT quoted > > ~ > > Please confirm --- So, you are expecting that Partitions and Child > tables should also be quoted, so that everything looks the same? > > This is scope creep from the original intent of this thread, so I will > look at doing this in a separate patch 0003. > > ====== > Kind Regards > Peter Smith. > Fujitsu Australia Actually I don’t know the rule, which should be quoted and which should not. Is the inconstancy a blocker? So, I was just pointing out the inconsistency, and I want to hear a clarification from someone. Best regards, -- Chao Li (Evan) HighGo Software Co., Ltd. https://www.highgo.com/ -
Re: Fix how some lists are displayed by psql \d+
Peter Smith <smithpb2250@gmail.com> — 2026-01-21T21:08:31Z
On Wed, Jan 21, 2026 at 7:30 PM Chao Li <li.evan.chao@gmail.com> wrote: > > > > > On Jan 21, 2026, at 16:22, Peter Smith <smithpb2250@gmail.com> wrote: > > > > On Wed, Jan 21, 2026 at 7:05 PM Chao Li <li.evan.chao@gmail.com> wrote: > >> > >> > >> > >>> On Jan 21, 2026, at 10:58, Peter Smith <smithpb2250@gmail.com> wrote: > >>> > >>> A rebase was needed for some more test expected output changes. > >>> > >>> PSA v2. > >>> > >>> ====== > >>> Kind Regards, > >>> Peter Smith. > >>> Fujitsu Australia > >>> <v2-0002-Fix-to-make-psql-d-lists-of-inherits-look-same-as.patch><v2-0001-Fix-to-make-psql-d-lists-of-partitions-look-same-.patch> > >> > >> I still see some difference: > >> ``` > >> evantest=# \d+ p_test; > >> Partitioned table "public.p_test" > >> Column | Type | Collation | Nullable | Default | Storage | Compression | Stats target | Description > >> ----------+---------+-----------+----------+---------+----------+-------------+--------------+------------- > >> id | integer | | | | plain | | | > >> username | text | | | | extended | | | > >> category | text | | | | extended | | | > >> Partition key: LIST (category) > >> Indexes: > >> "idx_p_test_id" btree (id) > >> Partitions: > >> p_test_v1 FOR VALUES IN ('A') > >> p_test_v2 FOR VALUES IN ('B') > >> ``` > >> > >> The index name is quoted, but the partition names are not. > >> > > > > AFAICT > > Indexes are quoted > > Constraints are quoted > > Publications are also quoted > > > > Partitions are NOT quoted > > Inherits are NOT quoted > > > > ~ > > > > Please confirm --- So, you are expecting that Partitions and Child > > tables should also be quoted, so that everything looks the same? > > > > This is scope creep from the original intent of this thread, so I will > > look at doing this in a separate patch 0003. > > > > ====== > > Kind Regards > > Peter Smith. > > Fujitsu Australia > > Actually I don’t know the rule, which should be quoted and which should not. Is the inconstancy a blocker? > > So, I was just pointing out the inconsistency, and I want to hear a clarification from someone. > OK. I feel that the "Partitions" and "Child tables" + "Interits" might be the odd ones out here, just as those were the odd ones out re the list indentation logic. But I will hold off on adding quotes for them until I hear some committer advice that it would be a worthwhile change. ====== Kind Regards, Peter Smith. Fujitsu Australia -
Re: Fix how some lists are displayed by psql \d+
Soumya S Murali <soumyamurali.work@gmail.com> — 2026-02-04T05:00:27Z
Hi all, Thank you for updating the patches. On Tue, Feb 3, 2026 at 3:24 PM Peter Smith <smithpb2250@gmail.com> wrote: > > On Wed, Jan 21, 2026 at 7:30 PM Chao Li <li.evan.chao@gmail.com> wrote: > > > > > > > > > On Jan 21, 2026, at 16:22, Peter Smith <smithpb2250@gmail.com> wrote: > > > > > > On Wed, Jan 21, 2026 at 7:05 PM Chao Li <li.evan.chao@gmail.com> wrote: > > >> > > >> > > >> > > >>> On Jan 21, 2026, at 10:58, Peter Smith <smithpb2250@gmail.com> wrote: > > >>> > > >>> A rebase was needed for some more test expected output changes. > > >>> > > >>> PSA v2. > > >>> > > >>> ====== > > >>> Kind Regards, > > >>> Peter Smith. > > >>> Fujitsu Australia > > >>> <v2-0002-Fix-to-make-psql-d-lists-of-inherits-look-same-as.patch><v2-0001-Fix-to-make-psql-d-lists-of-partitions-look-same-.patch> > > >> > > >> I still see some difference: > > >> ``` > > >> evantest=# \d+ p_test; > > >> Partitioned table "public.p_test" > > >> Column | Type | Collation | Nullable | Default | Storage | Compression | Stats target | Description > > >> ----------+---------+-----------+----------+---------+----------+-------------+--------------+------------- > > >> id | integer | | | | plain | | | > > >> username | text | | | | extended | | | > > >> category | text | | | | extended | | | > > >> Partition key: LIST (category) > > >> Indexes: > > >> "idx_p_test_id" btree (id) > > >> Partitions: > > >> p_test_v1 FOR VALUES IN ('A') > > >> p_test_v2 FOR VALUES IN ('B') > > >> ``` > > >> > > >> The index name is quoted, but the partition names are not. > > >> > > > > > > AFAICT > > > Indexes are quoted > > > Constraints are quoted > > > Publications are also quoted > > > > > > Partitions are NOT quoted > > > Inherits are NOT quoted > > > > > > ~ > > > > > > Please confirm --- So, you are expecting that Partitions and Child > > > tables should also be quoted, so that everything looks the same? > > > > > > This is scope creep from the original intent of this thread, so I will > > > look at doing this in a separate patch 0003. > > > > > > ====== > > > Kind Regards > > > Peter Smith. > > > Fujitsu Australia > > > > Actually I don’t know the rule, which should be quoted and which should not. Is the inconstancy a blocker? > > > > So, I was just pointing out the inconsistency, and I want to hear a clarification from someone. > > > > OK. I feel that the "Partitions" and "Child tables" + "Interits" might > be the odd ones out here, just as those were the odd ones out re the > list indentation logic. > > But I will hold off on adding quotes for them until I hear some > committer advice that it would be a worthwhile change. I went through the discussions and verified the unpatched psql display and after tested the v2 patches on the current master. The patches applied cleanly, make check and tests passed successfully and using the patches confirms that "Partitions" and "Child tables" are now displayed consistently as intended. LGTM from my side. Regards, Soumya -
Re: Fix how some lists are displayed by psql \d+
Peter Smith <smithpb2250@gmail.com> — 2026-03-20T03:48:29Z
Ping, This thread has been idle for about 6 weeks but AFAIK the patch is good to go. Is there any else I can do to help move it forwards? ====== Kind Regards, Peter Smith. Fujitsu Australia
-
Re: Fix how some lists are displayed by psql \d+
Fujii Masao <masao.fujii@gmail.com> — 2026-03-26T03:18:25Z
On Fri, Mar 20, 2026 at 12:49 PM Peter Smith <smithpb2250@gmail.com> wrote: > > Ping, This thread has been idle for about 6 weeks but AFAIK the patch > is good to go. > > Is there any else I can do to help move it forwards? I like the updated \d+ display. The patch looks good to me. So, barring objections, I'm thinking to commit it. BTW, with these changes there appear to be no remaining callers of pg_wcswidth() in the core. I'm not sure if we should remove it, or keep it for reference or potential external use, though. Regards, -- Fujii Masao
-
Re: Fix how some lists are displayed by psql \d+
Fujii Masao <masao.fujii@gmail.com> — 2026-03-30T02:23:02Z
On Thu, Mar 26, 2026 at 12:18 PM Fujii Masao <masao.fujii@gmail.com> wrote: > > On Fri, Mar 20, 2026 at 12:49 PM Peter Smith <smithpb2250@gmail.com> wrote: > > > > Ping, This thread has been idle for about 6 weeks but AFAIK the patch > > is good to go. > > > > Is there any else I can do to help move it forwards? > > I like the updated \d+ display. The patch looks good to me. > So, barring objections, I'm thinking to commit it. I've pushed the patches. Thanks! Regards, -- Fujii Masao
-
Re: Fix how some lists are displayed by psql \d+
Peter Smith <smithpb2250@gmail.com> — 2026-03-30T21:55:56Z
On Mon, Mar 30, 2026 at 1:23 PM Fujii Masao <masao.fujii@gmail.com> wrote: > > On Thu, Mar 26, 2026 at 12:18 PM Fujii Masao <masao.fujii@gmail.com> wrote: > > > > On Fri, Mar 20, 2026 at 12:49 PM Peter Smith <smithpb2250@gmail.com> wrote: > > > > > > Ping, This thread has been idle for about 6 weeks but AFAIK the patch > > > is good to go. > > > > > > Is there any else I can do to help move it forwards? > > > > I like the updated \d+ display. The patch looks good to me. > > So, barring objections, I'm thinking to commit it. > > I've pushed the patches. Thanks! > Thanks for pushing! ====== Kind Regards, Peter Smith. Fujitsu Australia