diff options
Diffstat (limited to 'src/bin/psql/describe.c')
-rw-r--r-- | src/bin/psql/describe.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c index b705cb29dd4..c4370a1dd39 100644 --- a/src/bin/psql/describe.c +++ b/src/bin/psql/describe.c @@ -2697,7 +2697,7 @@ listCasts(const char *pattern) * Describes schemas (namespaces) */ bool -listSchemas(const char *pattern, bool verbose) +listSchemas(const char *pattern, bool verbose, bool showSystem) { PQExpBufferData buf; PGresult *res; @@ -2720,11 +2720,14 @@ listSchemas(const char *pattern, bool verbose) } appendPQExpBuffer(&buf, - "\nFROM pg_catalog.pg_namespace n\n" - "WHERE (n.nspname !~ '^pg_temp_' OR\n" - " n.nspname = (pg_catalog.current_schemas(true))[1])\n"); /* temp schema is first */ + "\nFROM pg_catalog.pg_namespace n\n"); - processSQLNamePattern(pset.db, &buf, pattern, true, false, + if (!showSystem && !pattern) + appendPQExpBuffer(&buf, + "WHERE n.nspname !~ '^pg_' AND n.nspname <> 'information_schema'\n"); + + processSQLNamePattern(pset.db, &buf, pattern, + !showSystem && !pattern, false, NULL, "n.nspname", NULL, NULL); |