On Thu, Mar 27, 2014 at 10:02:20AM +0100, Christoph Berg wrote: > Re: Bruce Momjian 2014-03-26 <20140326161056.ga...@momjian.us> > > The attached patch matches your suggestion. It is basically back to > > what the code originally had, except it skips system tables, and shows > > "???" for invalid values. > > Fwiw, "make check-world" is currently broken:
Yes, the patch was partial to just show the code changes, to get approval. Attached is the full patch. I did some research of the regression database to see what was being set: SELECT relreplident, relkind, nspname, count(*) FROM pg_class, pg_namespace WHERE relkind IN ('m', 'r') AND relnamespace = pg_namespace.oid AND nspname != 'pg_catalog' GROUP BY relreplident, nspname, relkind ORDER BY 1, 2, 3; relreplident | relkind | nspname | count --------------+---------+--------------------+------- d | m | mvschema | 1 d | m | public | 5 d | r | information_schema | 7 d | r | public | 205 d | r | testxmlschema | 3 It seems everything is default, which would not be displayed. -- Bruce Momjian <br...@momjian.us> http://momjian.us EnterpriseDB http://enterprisedb.com + Everyone has their own god. +
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c new file mode 100644 index 21bbdf8..d1447fe *** a/src/bin/psql/describe.c --- b/src/bin/psql/describe.c *************** describeOneTableDetails(const char *sche *** 2345,2360 **** printTableAddFooter(&cont, buf.data); } ! if (verbose && (tableinfo.relkind == 'r' || tableinfo.relkind == 'm') && strcmp(schemaname, "pg_catalog") != 0) { const char *s = _("Replica Identity"); printfPQExpBuffer(&buf, "%s: %s", s, - tableinfo.relreplident == 'd' ? "DEFAULT" : tableinfo.relreplident == 'f' ? "FULL" : - tableinfo.relreplident == 'i' ? "USING INDEX" : tableinfo.relreplident == 'n' ? "NOTHING" : "???"); --- 2345,2363 ---- printTableAddFooter(&cont, buf.data); } ! if ((tableinfo.relkind == 'r' || tableinfo.relkind == 'm') && ! /* ! * No need to display default values; we already display a ! * REPLICA IDENTITY marker on indexes. ! */ ! tableinfo.relreplident != 'd' && tableinfo.relreplident != 'i' && strcmp(schemaname, "pg_catalog") != 0) { const char *s = _("Replica Identity"); printfPQExpBuffer(&buf, "%s: %s", s, tableinfo.relreplident == 'f' ? "FULL" : tableinfo.relreplident == 'n' ? "NOTHING" : "???"); diff --git a/src/test/regress/expected/create_table_like.out b/src/test/regress/expected/create_table_like.out new file mode 100644 index feb6c93..5f29b39 *** a/src/test/regress/expected/create_table_like.out --- b/src/test/regress/expected/create_table_like.out *************** CREATE TABLE ctlt12_storage (LIKE ctlt1 *** 115,121 **** a | text | not null | main | | b | text | | extended | | c | text | | external | | - Replica Identity: DEFAULT Has OIDs: no CREATE TABLE ctlt12_comments (LIKE ctlt1 INCLUDING COMMENTS, LIKE ctlt2 INCLUDING COMMENTS); --- 115,120 ---- *************** CREATE TABLE ctlt12_comments (LIKE ctlt1 *** 126,132 **** a | text | not null | extended | | A b | text | | extended | | B c | text | | extended | | C - Replica Identity: DEFAULT Has OIDs: no CREATE TABLE ctlt1_inh (LIKE ctlt1 INCLUDING CONSTRAINTS INCLUDING COMMENTS) INHERITS (ctlt1); --- 125,130 ---- *************** NOTICE: merging constraint "ctlt1_a_che *** 142,148 **** Check constraints: "ctlt1_a_check" CHECK (length(a) > 2) Inherits: ctlt1 - Replica Identity: DEFAULT Has OIDs: no SELECT description FROM pg_description, pg_constraint c WHERE classoid = 'pg_constraint'::regclass AND objoid = c.oid AND c.conrelid = 'ctlt1_inh'::regclass; --- 140,145 ---- *************** Check constraints: *** 165,171 **** "ctlt3_a_check" CHECK (length(a) < 5) Inherits: ctlt1, ctlt3 - Replica Identity: DEFAULT Has OIDs: no CREATE TABLE ctlt13_like (LIKE ctlt3 INCLUDING CONSTRAINTS INCLUDING COMMENTS INCLUDING STORAGE) INHERITS (ctlt1); --- 162,167 ---- *************** Check constraints: *** 181,187 **** "ctlt1_a_check" CHECK (length(a) > 2) "ctlt3_a_check" CHECK (length(a) < 5) Inherits: ctlt1 - Replica Identity: DEFAULT Has OIDs: no SELECT description FROM pg_description, pg_constraint c WHERE classoid = 'pg_constraint'::regclass AND objoid = c.oid AND c.conrelid = 'ctlt13_like'::regclass; --- 177,182 ---- *************** Indexes: *** 203,209 **** "ctlt_all_expr_idx" btree ((a || b)) Check constraints: "ctlt1_a_check" CHECK (length(a) > 2) - Replica Identity: DEFAULT Has OIDs: no 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; --- 198,203 ---- diff --git a/src/test/regress/expected/inherit.out b/src/test/regress/expected/inherit.out new file mode 100644 index 7f2eeea..c84c435 *** a/src/test/regress/expected/inherit.out --- b/src/test/regress/expected/inherit.out *************** ALTER TABLE inhts RENAME d TO dd; *** 913,919 **** dd | integer | | plain | | Inherits: inht1, inhs1 - Replica Identity: DEFAULT Has OIDs: no DROP TABLE inhts; --- 913,918 ---- *************** ALTER TABLE inht1 RENAME aa TO aaa; *** 935,941 **** z | integer | | plain | | Inherits: inht2, inht3 - Replica Identity: DEFAULT Has OIDs: no CREATE TABLE inhts (d int) INHERITS (inht2, inhs1); --- 934,939 ---- *************** ERROR: cannot rename inherited column " *** 954,960 **** d | integer | | plain | | Inherits: inht2, inhs1 - Replica Identity: DEFAULT Has OIDs: no WITH RECURSIVE r AS ( --- 952,957 ---- *************** CREATE TABLE test_constraints_inh () INH *** 1002,1008 **** Indexes: "test_constraints_val1_val2_key" UNIQUE CONSTRAINT, btree (val1, val2) Child tables: test_constraints_inh - Replica Identity: DEFAULT Has OIDs: no ALTER TABLE ONLY test_constraints DROP CONSTRAINT test_constraints_val1_val2_key; --- 999,1004 ---- *************** ALTER TABLE ONLY test_constraints DROP C *** 1014,1020 **** val1 | character varying | | extended | | val2 | integer | | plain | | Child tables: test_constraints_inh - Replica Identity: DEFAULT Has OIDs: no \d+ test_constraints_inh --- 1010,1015 ---- *************** Has OIDs: no *** 1025,1031 **** val1 | character varying | | extended | | val2 | integer | | plain | | Inherits: test_constraints - Replica Identity: DEFAULT Has OIDs: no DROP TABLE test_constraints_inh; --- 1020,1025 ---- *************** CREATE TABLE test_ex_constraints_inh () *** 1043,1049 **** Indexes: "test_ex_constraints_c_excl" EXCLUDE USING gist (c WITH &&) Child tables: test_ex_constraints_inh - Replica Identity: DEFAULT Has OIDs: no ALTER TABLE test_ex_constraints DROP CONSTRAINT test_ex_constraints_c_excl; --- 1037,1042 ---- *************** ALTER TABLE test_ex_constraints DROP CON *** 1053,1059 **** --------+--------+-----------+---------+--------------+------------- c | circle | | plain | | Child tables: test_ex_constraints_inh - Replica Identity: DEFAULT Has OIDs: no \d+ test_ex_constraints_inh --- 1046,1051 ---- *************** Has OIDs: no *** 1062,1068 **** --------+--------+-----------+---------+--------------+------------- c | circle | | plain | | Inherits: test_ex_constraints - Replica Identity: DEFAULT Has OIDs: no DROP TABLE test_ex_constraints_inh; --- 1054,1059 ---- *************** Indexes: *** 1080,1086 **** "test_primary_constraints_pkey" PRIMARY KEY, btree (id) Referenced by: TABLE "test_foreign_constraints" CONSTRAINT "test_foreign_constraints_id1_fkey" FOREIGN KEY (id1) REFERENCES test_primary_constraints(id) - Replica Identity: DEFAULT Has OIDs: no \d+ test_foreign_constraints --- 1071,1076 ---- *************** Has OIDs: no *** 1091,1097 **** Foreign-key constraints: "test_foreign_constraints_id1_fkey" FOREIGN KEY (id1) REFERENCES test_primary_constraints(id) Child tables: test_foreign_constraints_inh - Replica Identity: DEFAULT Has OIDs: no ALTER TABLE test_foreign_constraints DROP CONSTRAINT test_foreign_constraints_id1_fkey; --- 1081,1086 ---- *************** ALTER TABLE test_foreign_constraints DRO *** 1101,1107 **** --------+---------+-----------+---------+--------------+------------- id1 | integer | | plain | | Child tables: test_foreign_constraints_inh - Replica Identity: DEFAULT Has OIDs: no \d+ test_foreign_constraints_inh --- 1090,1095 ---- *************** Has OIDs: no *** 1110,1116 **** --------+---------+-----------+---------+--------------+------------- id1 | integer | | plain | | Inherits: test_foreign_constraints - Replica Identity: DEFAULT Has OIDs: no DROP TABLE test_foreign_constraints_inh; --- 1098,1103 ---- diff --git a/src/test/regress/expected/matview.out b/src/test/regress/expected/matview.out new file mode 100644 index 37db38d..daf3b9e *** a/src/test/regress/expected/matview.out --- b/src/test/regress/expected/matview.out *************** View definition: *** 104,110 **** tv.totamt FROM tv ORDER BY tv.type; - Replica Identity: DEFAULT \d+ tvm Materialized view "public.tvm" --- 104,109 ---- *************** View definition: *** 117,123 **** tv.totamt FROM tv ORDER BY tv.type; - Replica Identity: DEFAULT \d+ tvvm Materialized view "public.tvvm" --- 116,121 ---- *************** Replica Identity: DEFAULT *** 127,133 **** View definition: SELECT tvv.grandtot FROM tvv; - Replica Identity: DEFAULT \d+ bb Materialized view "public.bb" --- 125,130 ---- *************** Indexes: *** 139,145 **** View definition: SELECT tvvmv.grandtot FROM tvvmv; - Replica Identity: DEFAULT -- test schema behavior CREATE SCHEMA mvschema; --- 136,141 ---- *************** Indexes: *** 156,162 **** View definition: SELECT sum(tvm.totamt) AS grandtot FROM mvschema.tvm; - Replica Identity: DEFAULT SET search_path = mvschema, public; \d+ tvm --- 152,157 ---- *************** View definition: *** 170,176 **** tv.totamt FROM tv ORDER BY tv.type; - Replica Identity: DEFAULT -- modify the underlying table data INSERT INTO t VALUES (6, 'z', 13); --- 165,170 ---- *************** UNION ALL *** 375,381 **** SELECT v_test2.moo, 3 * v_test2.moo FROM v_test2; - Replica Identity: DEFAULT CREATE MATERIALIZED VIEW mv_test3 AS SELECT * FROM mv_test2 WHERE moo = 12345; SELECT relispopulated FROM pg_class WHERE oid = 'mv_test3'::regclass; --- 369,374 ---- diff --git a/src/test/regress/expected/replica_identity.out b/src/test/regress/expected/replica_identity.out new file mode 100644 index aeaf0fb..a93897f *** a/src/test/regress/expected/replica_identity.out --- b/src/test/regress/expected/replica_identity.out *************** Indexes: *** 170,175 **** --- 170,176 ---- "test_replica_identity_unique_nondefer" UNIQUE CONSTRAINT, btree (keya, keyb) "test_replica_identity_hash" hash (nonkey) "test_replica_identity_keyab" btree (keya, keyb) + Replica Identity: FULL ALTER TABLE test_replica_identity REPLICA IDENTITY NOTHING; SELECT relreplident FROM pg_class WHERE oid = 'test_replica_identity'::regclass; diff --git a/src/test/regress/expected/rules.out b/src/test/regress/expected/rules.out new file mode 100644 index 25a36f4..b0b6e27 *** a/src/test/regress/expected/rules.out --- b/src/test/regress/expected/rules.out *************** Rules: *** 2609,2615 **** r3 AS ON DELETE TO rules_src DO NOTIFY rules_src_deletion - Replica Identity: DEFAULT Has OIDs: no -- --- 2609,2614 ----
-- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers