On 2013-12-14 17:43:36 +0100, Andres Freund wrote:
> On 2013-12-14 11:27:53 -0500, Tom Lane wrote:
> > In HEAD:
> > 
> > regression=# \d pg_depend
> >    Table "pg_catalog.pg_depend"
> >    Column    |  Type   | Modifiers 
> > -------------+---------+-----------
> >  classid     | oid     | not null
> >  objid       | oid     | not null
> >  objsubid    | integer | not null
> >  refclassid  | oid     | not null
> >  refobjid    | oid     | not null
> >  refobjsubid | integer | not null
> >  deptype     | "char"  | not null
> > Indexes:
> >     "pg_depend_depender_index" btree (classid, objid, objsubid)
> >     "pg_depend_reference_index" btree (refclassid, refobjid, refobjsubid)
> > Replica Identity: NOTHING
> > 
> > Where did that last line come from, and who thinks it's so important
> > that it should appear by default?  It seems absolutely content-free
> > even if I were using whatever feature it refers to, since it is
> > (I presume) the default state.
> 
> Hm. Yes, that's slightly inellegant. It's shown because it's not
> actually the normal default normal tables. Just for system tables. Maybe
> we should just set it to default (in pg_class) for system tables as
> well, and just change it in the relcache.

Hm. I don't like that choice much after thinking for a bit. Seems to
make querying the catalog unneccessarily complex.
How about making it conditional on the table's namespace instead? That
will do the wrong thing if somebody moves a table to pg_catalog and
configures a replica identity, but I think we can live with that, given
how many other things work strangely around that.

Patch attached.

Greetings,

Andres Freund

-- 
 Andres Freund                     http://www.2ndQuadrant.com/
 PostgreSQL Development, 24x7 Support, Training & Services
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index 96322ca..4e132c8 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -2310,7 +2310,13 @@ describeOneTableDetails(const char *schemaname,
 			printTableAddFooter(&cont, buf.data);
 		}
 
-		if ((tableinfo.relkind == 'r' || tableinfo.relkind == 'm') &&
+		/*
+		 * Show the table's replica identity, if nondefault, not USING INDEX,
+		 * and not a system catalog. If configured using an index, it will
+		 * display the identity when displaying the selected index above.
+		 */
+		if (strcmp("schemaname", "pg_catalog") != 0 &&
+			(tableinfo.relkind == 'r' || tableinfo.relkind == 'm') &&
 			tableinfo.relreplident != 'd' && tableinfo.relreplident != 'i')
 		{
 			const char *s = _("Replica Identity");
-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Reply via email to