Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit a922472

Browse files
committed
Supress non-temp schemas from psql \dn display.
1 parent afb09b5 commit a922472

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed

doc/src/sgml/ref/psql-ref.sgml

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!--
2-
$PostgreSQL: pgsql/doc/src/sgml/ref/psql-ref.sgml,v 1.101 2003/12/01 22:21:54 momjian Exp $
2+
$PostgreSQL: pgsql/doc/src/sgml/ref/psql-ref.sgml,v 1.102 2003/12/23 23:13:14 momjian Exp $
33
PostgreSQL documentation
44
-->
55

@@ -957,6 +957,7 @@ testdb=>
957957
Lists all available schemas (namespaces). If <replaceable
958958
class="parameter">pattern</replaceable> (a regular expression)
959959
is specified, only schemas whose names match the pattern are listed.
960+
Non-local temporary schemas are suppressed.
960961
</para>
961962
</listitem>
962963
</varlistentry>

src/bin/psql/describe.c

+7-6
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
*
44
* Copyright (c) 2000-2003, PostgreSQL Global Development Group
55
*
6-
* $PostgreSQL: pgsql/src/bin/psql/describe.c,v 1.90 2003/12/01 22:21:54 momjian Exp $
6+
* $PostgreSQL: pgsql/src/bin/psql/describe.c,v 1.91 2003/12/23 23:13:14 momjian Exp $
77
*/
88
#include "postgres_fe.h"
99
#include "describe.h"
@@ -1626,14 +1626,15 @@ listSchemas(const char *pattern)
16261626

16271627
initPQExpBuffer(&buf);
16281628
printfPQExpBuffer(&buf,
1629-
"SELECT n.nspname AS \"%s\",\n"
1630-
" u.usename AS \"%s\"\n"
1629+
"SELECT n.nspname AS \"%s\",\n"
1630+
" u.usename AS \"%s\"\n"
16311631
"FROM pg_catalog.pg_namespace n LEFT JOIN pg_catalog.pg_user u\n"
1632-
" ON n.nspowner=u.usesysid\n",
1632+
" ON n.nspowner=u.usesysid\n"
1633+
"WHERE (n.nspname NOT LIKE 'pg\\\\_temp\\\\_%%' OR\n"
1634+
" n.nspname = (pg_catalog.current_schemas(true))[1])\n", /* temp schema is first */
16331635
_("Name"),
16341636
_("Owner"));
1635-
1636-
processNamePattern(&buf, pattern, false, false,
1637+
processNamePattern(&buf, pattern, true, false,
16371638
NULL, "n.nspname", NULL,
16381639
NULL);
16391640

0 commit comments

Comments
 (0)