33 *
44 * Copyright 2000-2002 by PostgreSQL Global Development Group
55 *
6- * $Header: /cvsroot/pgsql/src/bin/psql/describe.c,v 1.68 2002/09/04 20:31:35 momjian Exp $
6+ * $Header: /cvsroot/pgsql/src/bin/psql/describe.c,v 1.69 2002/09/22 20:44:22 tgl Exp $
77 */
88#include "postgres_fe.h"
99#include "describe.h"
@@ -1231,7 +1231,7 @@ describeUsers(const char *pattern)
12311231 * i - indexes
12321232 * v - views
12331233 * s - sequences
1234- * S - system tables (~ '^pg_' )
1234+ * S - system tables (pg_catalog )
12351235 * (any order of the above is fine)
12361236 */
12371237bool
@@ -1247,7 +1247,7 @@ listTables(const char *tabtypes, const char *pattern, bool verbose)
12471247PGresult * res ;
12481248printQueryOpt myopt = pset .popt ;
12491249
1250- if (showSystem && !( showSeq || showIndexes || showViews || showTables ))
1250+ if (!( showTables || showIndexes || showViews || showSeq ))
12511251showTables = showViews = showSeq = true;
12521252
12531253initPQExpBuffer (& buf );
@@ -1296,18 +1296,19 @@ listTables(const char *tabtypes, const char *pattern, bool verbose)
12961296appendPQExpBuffer (& buf ,")\n" );
12971297
12981298/*
1299- * Unless showSystem is specified, we suppress system tables, ie,
1299+ * If showSystem is specified, show only system objects (those in
1300+ * pg_catalog). Otherwise, suppress system objects, including
13001301 * those in pg_catalog and pg_toast. (We don't want to hide temp
13011302 * tables though.)
13021303 */
13031304if (showSystem )
1304- processNamePattern (& buf ,pattern , true, false,
1305- "n.nspname" ,"c.relname" ,NULL ,
1306- "pg_catalog.pg_table_is_visible(c.oid)" );
1305+ appendPQExpBuffer (& buf ," AND n.nspname = 'pg_catalog'\n" );
13071306else
1308- processNamePattern (& buf ,pattern , true, false,
1309- "n.nspname" ,"c.relname" ,NULL ,
1310- "pg_catalog.pg_table_is_visible(c.oid) AND n.nspname <> 'pg_catalog' AND n.nspname <> 'pg_toast'" );
1307+ appendPQExpBuffer (& buf ," AND n.nspname NOT IN ('pg_catalog', 'pg_toast')\n" );
1308+
1309+ processNamePattern (& buf ,pattern , true, false,
1310+ "n.nspname" ,"c.relname" ,NULL ,
1311+ "pg_catalog.pg_table_is_visible(c.oid)" );
13111312
13121313appendPQExpBuffer (& buf ,"ORDER BY 1,2;" );
13131314