postgres.git / summary / log / commit / refs
commit baa7b142aace6821ce085906f314a75bcc4d95c8
Author: Michael Paquier <michael@paquier.xyz>
Date: Mon Aug 17 00:21:08 2026 +0000
First released in: 18.7, 19.0
psql: Fix \d+ display of REPLICA IDENTITY NOTHING
Commit 18954ce7f69 has replaced hardcoded relreplident values in
describe.c with CppAsString2 macros, but used a DEFAULT instead of a
NOTHING at one location. This caused \d+ on a table with REPLICA
IDENTITY NOTHING to show incorrect data.
Author: Shinya Kato <shinya11.kato@gmail.com>
Discussion: https://postgr.es/m/CAOzEurRHWt+9XLBrbXQOSVkE45NksJ4F28twuqgZ7veW0RzpUQ@mail.gmail.com
Backpatch-through: 18
src/bin/psql/describe.c | 2 +-
src/test/regress/expected/replica_identity.out | 24 ++++++++++++++++++++++++
src/test/regress/sql/replica_identity.sql | 1 +
3 files changed, 26 insertions(+), 1 deletion(-)
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index 31f12f89439..368941dcf95 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3590,7 +3590,7 @@ describeOneTableDetails(const char *schemaname,
printfPQExpBuffer(&buf, "%s: %s",
s,
tableinfo.relreplident == REPLICA_IDENTITY_FULL ? "FULL" :
- tableinfo.relreplident == REPLICA_IDENTITY_DEFAULT ? "NOTHING" :
+ tableinfo.relreplident == REPLICA_IDENTITY_NOTHING ? "NOTHING" :
"???");
printTableAddFooter(&cont, buf.data);
diff --git a/src/test/regress/expected/replica_identity.out b/src/test/regress/expected/replica_identity.out
index 291c6a1b91d..c06c0103150 100644
--- a/src/test/regress/expected/replica_identity.out
+++ b/src/test/regress/expected/replica_identity.out
@@ -187,6 +187,30 @@ SELECT relreplident FROM pg_class WHERE oid = 'test_replica_identity'::regclass;
n
(1 row)
+\d+ test_replica_identity
+ Table "public.test_replica_identity"
+ Column | Type | Collation | Nullable | Default | Storage | Stats target | Description
+--------+---------+-----------+----------+---------------------------------------------------+----------+--------------+-------------
+ id | integer | | not null | nextval('test_replica_identity_id_seq'::regclass) | plain | |
+ keya | text | | not null | | extended | |
+ keyb | text | | not null | | extended | |
+ nonkey | text | | | | extended | |
+Indexes:
+ "test_replica_identity_pkey" PRIMARY KEY, btree (id)
+ "test_replica_identity_expr" UNIQUE, btree (keya, keyb, (3))
+ "test_replica_identity_hash" hash (nonkey)
+ "test_replica_identity_keyab" btree (keya, keyb)
+ "test_replica_identity_keyab_key" UNIQUE, btree (keya, keyb)
+ "test_replica_identity_nonkey" UNIQUE, btree (keya, nonkey)
+ "test_replica_identity_partial" UNIQUE, btree (keya, keyb) WHERE keyb <> '3'::text
+ "test_replica_identity_unique_defer" UNIQUE CONSTRAINT, btree (keya, keyb) DEFERRABLE
+ "test_replica_identity_unique_nondefer" UNIQUE CONSTRAINT, btree (keya, keyb)
+Not-null constraints:
+ "test_replica_identity_id_not_null" NOT NULL "id"
+ "test_replica_identity_keya_not_null" NOT NULL "keya"
+ "test_replica_identity_keyb_not_null" NOT NULL "keyb"
+Replica Identity: NOTHING
+
---
-- Test that ALTER TABLE rewrite preserves nondefault replica identity
---
diff --git a/src/test/regress/sql/replica_identity.sql b/src/test/regress/sql/replica_identity.sql
index b202b30ae2b..4ebb097f282 100644
--- a/src/test/regress/sql/replica_identity.sql
+++ b/src/test/regress/sql/replica_identity.sql
@@ -77,6 +77,7 @@ SELECT relreplident FROM pg_class WHERE oid = 'test_replica_identity'::regclass;
\d+ test_replica_identity
ALTER TABLE test_replica_identity REPLICA IDENTITY NOTHING;
SELECT relreplident FROM pg_class WHERE oid = 'test_replica_identity'::regclass;
+\d+ test_replica_identity
---
-- Test that ALTER TABLE rewrite preserves nondefault replica identity
[parent: 0391fee2dc30]