From a922472a2aacdbb802a375284f5fdffe64cadad5 Mon Sep 17 00:00:00 2001 From: Bruce Momjian Date: Tue, 23 Dec 2003 23:13:14 +0000 Subject: [PATCH] Supress non-temp schemas from psql \dn display. --- doc/src/sgml/ref/psql-ref.sgml | 3 ++- src/bin/psql/describe.c | 13 +++++++------ 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml index b398251745..58aa40e72a 100644 --- a/doc/src/sgml/ref/psql-ref.sgml +++ b/doc/src/sgml/ref/psql-ref.sgml @@ -1,5 +1,5 @@ @@ -957,6 +957,7 @@ testdb=> Lists all available schemas (namespaces). If pattern (a regular expression) is specified, only schemas whose names match the pattern are listed. + Non-local temporary schemas are suppressed. diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c index 66a7d7b5d2..96903c8be0 100644 --- a/src/bin/psql/describe.c +++ b/src/bin/psql/describe.c @@ -3,7 +3,7 @@ * * Copyright (c) 2000-2003, PostgreSQL Global Development Group * - * $PostgreSQL: pgsql/src/bin/psql/describe.c,v 1.90 2003/12/01 22:21:54 momjian Exp $ + * $PostgreSQL: pgsql/src/bin/psql/describe.c,v 1.91 2003/12/23 23:13:14 momjian Exp $ */ #include "postgres_fe.h" #include "describe.h" @@ -1626,14 +1626,15 @@ listSchemas(const char *pattern) initPQExpBuffer(&buf); printfPQExpBuffer(&buf, - "SELECT n.nspname AS \"%s\",\n" - " u.usename AS \"%s\"\n" + "SELECT n.nspname AS \"%s\",\n" + " u.usename AS \"%s\"\n" "FROM pg_catalog.pg_namespace n LEFT JOIN pg_catalog.pg_user u\n" - " ON n.nspowner=u.usesysid\n", + " ON n.nspowner=u.usesysid\n" + "WHERE (n.nspname NOT LIKE 'pg\\\\_temp\\\\_%%' OR\n" + " n.nspname = (pg_catalog.current_schemas(true))[1])\n", /* temp schema is first */ _("Name"), _("Owner")); - - processNamePattern(&buf, pattern, false, false, + processNamePattern(&buf, pattern, true, false, NULL, "n.nspname", NULL, NULL); -- 2.40.0