From: Tom Lane Date: Sun, 22 Sep 2002 20:44:22 +0000 (+0000) Subject: Make \dS work more like it used to, viz, show only system objects. X-Git-Tag: REL7_3~424 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=286fb25243724d0b4bdb4ed06af250f34779db4a;p=postgresql Make \dS work more like it used to, viz, show only system objects. --- diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml index e10cdd9aa1..e2cec12ad2 100644 --- a/doc/src/sgml/ref/psql-ref.sgml +++ b/doc/src/sgml/ref/psql-ref.sgml @@ -1,5 +1,5 @@ @@ -884,7 +884,9 @@ testdb=> This is not the actual command name: the letters i, s, t, v, S stand for index, sequence, table, view, and system table, respectively. You can specify any or all of these letters, in any - order, to obtain a listing of all the matching objects. + order, to obtain a listing of all the matching objects. The letter + S restricts the listing to system objects; without S, only non-system + objects are shown. If + is appended to the command name, each object is listed with its associated description, if any. diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c index 239d984a08..9c4c93c0df 100644 --- a/src/bin/psql/describe.c +++ b/src/bin/psql/describe.c @@ -3,7 +3,7 @@ * * Copyright 2000-2002 by PostgreSQL Global Development Group * - * $Header: /cvsroot/pgsql/src/bin/psql/describe.c,v 1.68 2002/09/04 20:31:35 momjian Exp $ + * $Header: /cvsroot/pgsql/src/bin/psql/describe.c,v 1.69 2002/09/22 20:44:22 tgl Exp $ */ #include "postgres_fe.h" #include "describe.h" @@ -1231,7 +1231,7 @@ describeUsers(const char *pattern) * i - indexes * v - views * s - sequences - * S - system tables (~ '^pg_') + * S - system tables (pg_catalog) * (any order of the above is fine) */ bool @@ -1247,7 +1247,7 @@ listTables(const char *tabtypes, const char *pattern, bool verbose) PGresult *res; printQueryOpt myopt = pset.popt; - if (showSystem && !(showSeq || showIndexes || showViews || showTables)) + if (!(showTables || showIndexes || showViews || showSeq)) showTables = showViews = showSeq = true; initPQExpBuffer(&buf); @@ -1296,18 +1296,19 @@ listTables(const char *tabtypes, const char *pattern, bool verbose) appendPQExpBuffer(&buf, ")\n"); /* - * Unless showSystem is specified, we suppress system tables, ie, + * If showSystem is specified, show only system objects (those in + * pg_catalog). Otherwise, suppress system objects, including * those in pg_catalog and pg_toast. (We don't want to hide temp * tables though.) */ if (showSystem) - processNamePattern(&buf, pattern, true, false, - "n.nspname", "c.relname", NULL, - "pg_catalog.pg_table_is_visible(c.oid)"); + appendPQExpBuffer(&buf, " AND n.nspname = 'pg_catalog'\n"); else - processNamePattern(&buf, pattern, true, false, - "n.nspname", "c.relname", NULL, - "pg_catalog.pg_table_is_visible(c.oid) AND n.nspname <> 'pg_catalog' AND n.nspname <> 'pg_toast'"); + appendPQExpBuffer(&buf, " AND n.nspname NOT IN ('pg_catalog', 'pg_toast')\n"); + + processNamePattern(&buf, pattern, true, false, + "n.nspname", "c.relname", NULL, + "pg_catalog.pg_table_is_visible(c.oid)"); appendPQExpBuffer(&buf, "ORDER BY 1,2;");