summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/bin/psql/describe.c21
1 files changed, 11 insertions, 10 deletions
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index 239d984a08e..9c4c93c0df4 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;");