Skip to content

Commit 9d66116

Browse files
committed
psql: display "Replica Identity" only for FULL and NOTHING
INDEX is already displayed on the index, and we now exclude pg_catalog. DEFAULT is not displayed.
1 parent 62215de commit 9d66116

File tree

7 files changed

+7
-34
lines changed

7 files changed

+7
-34
lines changed

contrib/test_decoding/expected/ddl.out

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -345,7 +345,6 @@ WITH (user_catalog_table = true)
345345
options | text[] | | extended | |
346346
Indexes:
347347
"replication_metadata_pkey" PRIMARY KEY, btree (id)
348-
Replica Identity: DEFAULT
349348
Has OIDs: no
350349
Options: user_catalog_table=true
351350

@@ -361,7 +360,6 @@ ALTER TABLE replication_metadata RESET (user_catalog_table);
361360
options | text[] | | extended | |
362361
Indexes:
363362
"replication_metadata_pkey" PRIMARY KEY, btree (id)
364-
Replica Identity: DEFAULT
365363
Has OIDs: no
366364

367365
INSERT INTO replication_metadata(relation, options)
@@ -376,7 +374,6 @@ ALTER TABLE replication_metadata SET (user_catalog_table = true);
376374
options | text[] | | extended | |
377375
Indexes:
378376
"replication_metadata_pkey" PRIMARY KEY, btree (id)
379-
Replica Identity: DEFAULT
380377
Has OIDs: no
381378
Options: user_catalog_table=true
382379

@@ -397,7 +394,6 @@ ALTER TABLE replication_metadata SET (user_catalog_table = false);
397394
rewritemeornot | integer | | plain | |
398395
Indexes:
399396
"replication_metadata_pkey" PRIMARY KEY, btree (id)
400-
Replica Identity: DEFAULT
401397
Has OIDs: no
402398
Options: user_catalog_table=false
403399

src/bin/psql/describe.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2345,16 +2345,19 @@ describeOneTableDetails(const char *schemaname,
23452345
printTableAddFooter(&cont, buf.data);
23462346
}
23472347

2348-
if (verbose && (tableinfo.relkind == 'r' || tableinfo.relkind == 'm') &&
2348+
if ((tableinfo.relkind == 'r' || tableinfo.relkind == 'm') &&
2349+
/*
2350+
* No need to display default values; we already display a
2351+
* REPLICA IDENTITY marker on indexes.
2352+
*/
2353+
tableinfo.relreplident != 'd' && tableinfo.relreplident != 'i' &&
23492354
strcmp(schemaname, "pg_catalog") != 0)
23502355
{
23512356
const char *s = _("Replica Identity");
23522357

23532358
printfPQExpBuffer(&buf, "%s: %s",
23542359
s,
2355-
tableinfo.relreplident == 'd' ? "DEFAULT" :
23562360
tableinfo.relreplident == 'f' ? "FULL" :
2357-
tableinfo.relreplident == 'i' ? "USING INDEX" :
23582361
tableinfo.relreplident == 'n' ? "NOTHING" :
23592362
"???");
23602363

src/test/regress/expected/create_table_like.out

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,6 @@ CREATE TABLE ctlt12_storage (LIKE ctlt1 INCLUDING STORAGE, LIKE ctlt2 INCLUDING
115115
a | text | not null | main | |
116116
b | text | | extended | |
117117
c | text | | external | |
118-
Replica Identity: DEFAULT
119118
Has OIDs: no
120119

121120
CREATE TABLE ctlt12_comments (LIKE ctlt1 INCLUDING COMMENTS, LIKE ctlt2 INCLUDING COMMENTS);
@@ -126,7 +125,6 @@ CREATE TABLE ctlt12_comments (LIKE ctlt1 INCLUDING COMMENTS, LIKE ctlt2 INCLUDIN
126125
a | text | not null | extended | | A
127126
b | text | | extended | | B
128127
c | text | | extended | | C
129-
Replica Identity: DEFAULT
130128
Has OIDs: no
131129

132130
CREATE TABLE ctlt1_inh (LIKE ctlt1 INCLUDING CONSTRAINTS INCLUDING COMMENTS) INHERITS (ctlt1);
@@ -142,7 +140,6 @@ NOTICE: merging constraint "ctlt1_a_check" with inherited definition
142140
Check constraints:
143141
"ctlt1_a_check" CHECK (length(a) > 2)
144142
Inherits: ctlt1
145-
Replica Identity: DEFAULT
146143
Has OIDs: no
147144

148145
SELECT description FROM pg_description, pg_constraint c WHERE classoid = 'pg_constraint'::regclass AND objoid = c.oid AND c.conrelid = 'ctlt1_inh'::regclass;
@@ -165,7 +162,6 @@ Check constraints:
165162
"ctlt3_a_check" CHECK (length(a) < 5)
166163
Inherits: ctlt1,
167164
ctlt3
168-
Replica Identity: DEFAULT
169165
Has OIDs: no
170166

171167
CREATE TABLE ctlt13_like (LIKE ctlt3 INCLUDING CONSTRAINTS INCLUDING COMMENTS INCLUDING STORAGE) INHERITS (ctlt1);
@@ -181,7 +177,6 @@ Check constraints:
181177
"ctlt1_a_check" CHECK (length(a) > 2)
182178
"ctlt3_a_check" CHECK (length(a) < 5)
183179
Inherits: ctlt1
184-
Replica Identity: DEFAULT
185180
Has OIDs: no
186181

187182
SELECT description FROM pg_description, pg_constraint c WHERE classoid = 'pg_constraint'::regclass AND objoid = c.oid AND c.conrelid = 'ctlt13_like'::regclass;
@@ -203,7 +198,6 @@ Indexes:
203198
"ctlt_all_expr_idx" btree ((a || b))
204199
Check constraints:
205200
"ctlt1_a_check" CHECK (length(a) > 2)
206-
Replica Identity: DEFAULT
207201
Has OIDs: no
208202

209203
SELECT c.relname, objsubid, description FROM pg_description, pg_index i, pg_class c WHERE classoid = 'pg_class'::regclass AND objoid = i.indexrelid AND c.oid = i.indexrelid AND i.indrelid = 'ctlt_all'::regclass ORDER BY c.relname, objsubid;

src/test/regress/expected/inherit.out

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -913,7 +913,6 @@ ALTER TABLE inhts RENAME d TO dd;
913913
dd | integer | | plain | |
914914
Inherits: inht1,
915915
inhs1
916-
Replica Identity: DEFAULT
917916
Has OIDs: no
918917

919918
DROP TABLE inhts;
@@ -935,7 +934,6 @@ ALTER TABLE inht1 RENAME aa TO aaa;
935934
z | integer | | plain | |
936935
Inherits: inht2,
937936
inht3
938-
Replica Identity: DEFAULT
939937
Has OIDs: no
940938

941939
CREATE TABLE inhts (d int) INHERITS (inht2, inhs1);
@@ -954,7 +952,6 @@ ERROR: cannot rename inherited column "b"
954952
d | integer | | plain | |
955953
Inherits: inht2,
956954
inhs1
957-
Replica Identity: DEFAULT
958955
Has OIDs: no
959956

960957
WITH RECURSIVE r AS (
@@ -1002,7 +999,6 @@ CREATE TABLE test_constraints_inh () INHERITS (test_constraints);
1002999
Indexes:
10031000
"test_constraints_val1_val2_key" UNIQUE CONSTRAINT, btree (val1, val2)
10041001
Child tables: test_constraints_inh
1005-
Replica Identity: DEFAULT
10061002
Has OIDs: no
10071003

10081004
ALTER TABLE ONLY test_constraints DROP CONSTRAINT test_constraints_val1_val2_key;
@@ -1014,7 +1010,6 @@ ALTER TABLE ONLY test_constraints DROP CONSTRAINT test_constraints_val1_val2_key
10141010
val1 | character varying | | extended | |
10151011
val2 | integer | | plain | |
10161012
Child tables: test_constraints_inh
1017-
Replica Identity: DEFAULT
10181013
Has OIDs: no
10191014

10201015
\d+ test_constraints_inh
@@ -1025,7 +1020,6 @@ Has OIDs: no
10251020
val1 | character varying | | extended | |
10261021
val2 | integer | | plain | |
10271022
Inherits: test_constraints
1028-
Replica Identity: DEFAULT
10291023
Has OIDs: no
10301024

10311025
DROP TABLE test_constraints_inh;
@@ -1043,7 +1037,6 @@ CREATE TABLE test_ex_constraints_inh () INHERITS (test_ex_constraints);
10431037
Indexes:
10441038
"test_ex_constraints_c_excl" EXCLUDE USING gist (c WITH &&)
10451039
Child tables: test_ex_constraints_inh
1046-
Replica Identity: DEFAULT
10471040
Has OIDs: no
10481041

10491042
ALTER TABLE test_ex_constraints DROP CONSTRAINT test_ex_constraints_c_excl;
@@ -1053,7 +1046,6 @@ ALTER TABLE test_ex_constraints DROP CONSTRAINT test_ex_constraints_c_excl;
10531046
--------+--------+-----------+---------+--------------+-------------
10541047
c | circle | | plain | |
10551048
Child tables: test_ex_constraints_inh
1056-
Replica Identity: DEFAULT
10571049
Has OIDs: no
10581050

10591051
\d+ test_ex_constraints_inh
@@ -1062,7 +1054,6 @@ Has OIDs: no
10621054
--------+--------+-----------+---------+--------------+-------------
10631055
c | circle | | plain | |
10641056
Inherits: test_ex_constraints
1065-
Replica Identity: DEFAULT
10661057
Has OIDs: no
10671058

10681059
DROP TABLE test_ex_constraints_inh;
@@ -1080,7 +1071,6 @@ Indexes:
10801071
"test_primary_constraints_pkey" PRIMARY KEY, btree (id)
10811072
Referenced by:
10821073
TABLE "test_foreign_constraints" CONSTRAINT "test_foreign_constraints_id1_fkey" FOREIGN KEY (id1) REFERENCES test_primary_constraints(id)
1083-
Replica Identity: DEFAULT
10841074
Has OIDs: no
10851075

10861076
\d+ test_foreign_constraints
@@ -1091,7 +1081,6 @@ Has OIDs: no
10911081
Foreign-key constraints:
10921082
"test_foreign_constraints_id1_fkey" FOREIGN KEY (id1) REFERENCES test_primary_constraints(id)
10931083
Child tables: test_foreign_constraints_inh
1094-
Replica Identity: DEFAULT
10951084
Has OIDs: no
10961085

10971086
ALTER TABLE test_foreign_constraints DROP CONSTRAINT test_foreign_constraints_id1_fkey;
@@ -1101,7 +1090,6 @@ ALTER TABLE test_foreign_constraints DROP CONSTRAINT test_foreign_constraints_id
11011090
--------+---------+-----------+---------+--------------+-------------
11021091
id1 | integer | | plain | |
11031092
Child tables: test_foreign_constraints_inh
1104-
Replica Identity: DEFAULT
11051093
Has OIDs: no
11061094

11071095
\d+ test_foreign_constraints_inh
@@ -1110,7 +1098,6 @@ Has OIDs: no
11101098
--------+---------+-----------+---------+--------------+-------------
11111099
id1 | integer | | plain | |
11121100
Inherits: test_foreign_constraints
1113-
Replica Identity: DEFAULT
11141101
Has OIDs: no
11151102

11161103
DROP TABLE test_foreign_constraints_inh;

src/test/regress/expected/matview.out

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,6 @@ View definition:
104104
tv.totamt
105105
FROM tv
106106
ORDER BY tv.type;
107-
Replica Identity: DEFAULT
108107

109108
\d+ tvm
110109
Materialized view "public.tvm"
@@ -117,7 +116,6 @@ View definition:
117116
tv.totamt
118117
FROM tv
119118
ORDER BY tv.type;
120-
Replica Identity: DEFAULT
121119

122120
\d+ tvvm
123121
Materialized view "public.tvvm"
@@ -127,7 +125,6 @@ Replica Identity: DEFAULT
127125
View definition:
128126
SELECT tvv.grandtot
129127
FROM tvv;
130-
Replica Identity: DEFAULT
131128

132129
\d+ bb
133130
Materialized view "public.bb"
@@ -139,7 +136,6 @@ Indexes:
139136
View definition:
140137
SELECT tvvmv.grandtot
141138
FROM tvvmv;
142-
Replica Identity: DEFAULT
143139

144140
-- test schema behavior
145141
CREATE SCHEMA mvschema;
@@ -156,7 +152,6 @@ Indexes:
156152
View definition:
157153
SELECT sum(tvm.totamt) AS grandtot
158154
FROM mvschema.tvm;
159-
Replica Identity: DEFAULT
160155

161156
SET search_path = mvschema, public;
162157
\d+ tvm
@@ -170,7 +165,6 @@ View definition:
170165
tv.totamt
171166
FROM tv
172167
ORDER BY tv.type;
173-
Replica Identity: DEFAULT
174168

175169
-- modify the underlying table data
176170
INSERT INTO t VALUES (6, 'z', 13);
@@ -375,7 +369,6 @@ UNION ALL
375369
SELECT v_test2.moo,
376370
3 * v_test2.moo
377371
FROM v_test2;
378-
Replica Identity: DEFAULT
379372

380373
CREATE MATERIALIZED VIEW mv_test3 AS SELECT * FROM mv_test2 WHERE moo = 12345;
381374
SELECT relispopulated FROM pg_class WHERE oid = 'mv_test3'::regclass;

src/test/regress/expected/replica_identity.out

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,7 @@ Indexes:
170170
"test_replica_identity_unique_nondefer" UNIQUE CONSTRAINT, btree (keya, keyb)
171171
"test_replica_identity_hash" hash (nonkey)
172172
"test_replica_identity_keyab" btree (keya, keyb)
173+
Replica Identity: FULL
173174

174175
ALTER TABLE test_replica_identity REPLICA IDENTITY NOTHING;
175176
SELECT relreplident FROM pg_class WHERE oid = 'test_replica_identity'::regclass;

src/test/regress/expected/rules.out

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2609,7 +2609,6 @@ Rules:
26092609
r3 AS
26102610
ON DELETE TO rules_src DO
26112611
NOTIFY rules_src_deletion
2612-
Replica Identity: DEFAULT
26132612
Has OIDs: no
26142613

26152614
--

0 commit comments

Comments
 (0)