| From: | Srinath Reddy Sadipiralla <srinath2133(at)gmail(dot)com> |
|---|---|
| To: | imchifan(at)mail(dot)com, pgsql-bugs(at)lists(dot)postgresql(dot)org |
| Subject: | Re: BUG #19952: psql \d+ omits nondefault replica identity for partitioned tables |
| Date: | 2026-11-26 11:33:03 |
| Message-ID: | CAFC+b6pwsDFqdu2bKAouFd=Yhzd4jNee4qQcTEr_Byyewsx62Q@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-bugs |
Hi,
On Wed, Nov 25, 2026 at 11:22 PM PG Bug reporting form <
noreply(at)postgresql(dot)org> wrote:
>
>
> psql's \d+ does not display a partitioned table's nondefault replica
> identity, although ALTER TABLE accepts the setting and pg_class records it.
> The equivalent setting is displayed for an ordinary table.
>
> Run as a superuser.
>
> This can be reproduced with psql -X -f repro.sql:
>
> \set ON_ERROR_STOP on
> CREATE TABLE t_regular (id integer);
> CREATE TABLE t_partitioned (id integer) PARTITION BY RANGE (id);
> ALTER TABLE t_regular REPLICA IDENTITY FULL;
> ALTER TABLE t_partitioned REPLICA IDENTITY FULL;
>
> \pset format unaligned
> \pset tuples_only on
> SELECT relname || '|' || relkind::text || '|' || relreplident::text
> FROM pg_class
> WHERE relname IN ('t_regular', 't_partitioned')
> ORDER BY relname;
>
> \pset format aligned
> \pset tuples_only off
> \d+ t_regular
> \d+ t_partitioned
>
> The catalog query shows that both settings are FULL (`relreplident = 'f'`):
>
> t_partitioned|p|f
> t_regular|r|f
>
> The ordinary table's description includes:
>
> Replica Identity: FULL
> Access method: heap
>
> The partitioned table's description ends without the corresponding replica
> identity line:
>
> Partition key: RANGE (id)
> Number of partitions: 0
>
> Since REPLICA IDENTITY FULL is stored for the partitioned table, I expected
> its \d+ output to include `Replica Identity: FULL` as it does for the
> ordinary table.
>
Thanks for the report and the repro.
Agreed; \d+ currently doesn't display the replica identity for partitioned
tables,
and it makes sense to add it. The setting is already stored and preserved by
pg_dump/pg_restore, and showing it helps catch mismatches between a
partitioned table and its partitions during logical replication, since the
parent's
setting is sent to subscribers when publish_via_partition_root = true.
I am attaching a patch to fix this; thoughts?
--
Thanks :)
Srinath Reddy Sadipiralla
EDB: https://www.enterprisedb.com/
| Attachment | Content-Type | Size |
|---|---|---|
| v1-0001-psql-Show-replica-identity-of-partitioned-tables-.patch | application/octet-stream | 3.5 KB |
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Heikki Linnakangas | 2026-11-26 11:50:36 | Re: BUG #19928: pg_upgrade fails on v18 schema with NOT NULL ... NO INHERIT and inheritance |
| Previous Message | Shuntian Jiao | 2026-11-26 10:26:55 | Re: reltuples kept decreasing with each autovacuum run Re: BUG #18773 |