Tom Lane wrote:
> Bruce Momjian <[EMAIL PROTECTED]> writes:
> > Is current_schemas(true))[1] always the temp schema name?
> 
> If you have a temp schema; otherwise it'll be whatever is the front of
> your search path.
> 
> > That would clean things up nicely.
> 
> If you're intent on doing this in \dn, something like
> 
> ... AND (nspname not like 'pg\\_temp%'
>          OR nspname = (current_schemas(true))[1]) ...
> 
> would probably work well enough.

Yep, works fine.  Patch attached.  I wasn't so worried about telling
people the name of their temporary schema as I was giving them a
complete, reasonable \dn output.

-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  [EMAIL PROTECTED]               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073
Index: doc/src/sgml/ref/psql-ref.sgml
===================================================================
RCS file: /cvsroot/pgsql-server/doc/src/sgml/ref/psql-ref.sgml,v
retrieving revision 1.101
diff -c -c -r1.101 psql-ref.sgml
*** doc/src/sgml/ref/psql-ref.sgml      1 Dec 2003 22:21:54 -0000       1.101
--- doc/src/sgml/ref/psql-ref.sgml      23 Dec 2003 04:03:33 -0000
***************
*** 957,962 ****
--- 957,963 ----
          Lists all available schemas (namespaces). If <replaceable
          class="parameter">pattern</replaceable> (a regular expression)
          is specified, only schemas whose names match the pattern are listed.
+         Non-local temporary schemas are suppressed.
          </para>
          </listitem>
        </varlistentry>
Index: src/bin/psql/describe.c
===================================================================
RCS file: /cvsroot/pgsql-server/src/bin/psql/describe.c,v
retrieving revision 1.90
diff -c -c -r1.90 describe.c
*** src/bin/psql/describe.c     1 Dec 2003 22:21:54 -0000       1.90
--- src/bin/psql/describe.c     23 Dec 2003 04:03:35 -0000
***************
*** 1626,1639 ****
  
        initPQExpBuffer(&buf);
        printfPQExpBuffer(&buf,
!                                         "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",
                                          _("Name"),
                                          _("Owner"));
! 
!       processNamePattern(&buf, pattern, false, false,
                                           NULL, "n.nspname", NULL,
                                           NULL);
  
--- 1626,1640 ----
  
        initPQExpBuffer(&buf);
        printfPQExpBuffer(&buf,
!               "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"
!               "WHERE  n.nspname NOT LIKE 'pg_temp_%%' OR\n"
!               "               n.nspname = (current_schemas(true))[1]\n",      /* 
temp schema is first */
                                          _("Name"),
                                          _("Owner"));
!       processNamePattern(&buf, pattern, true, false,
                                           NULL, "n.nspname", NULL,
                                           NULL);
  
---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?

               http://www.postgresql.org/docs/faqs/FAQ.html

Reply via email to