X-Original-To: pgsql-docs-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 6629252B1D for ; Fri, 29 Jul 2005 23:30:12 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 10008-01 for ; Sat, 30 Jul 2005 02:30:07 +0000 (GMT) Received: from candle.pha.pa.us (candle.pha.pa.us [64.139.89.126]) by svr1.postgresql.org (Postfix) with ESMTP id 12B7952ADB for ; Fri, 29 Jul 2005 23:30:06 -0300 (ADT) Received: (from pgman@localhost) by candle.pha.pa.us (8.11.6/8.11.6) id j6U2UDS27599; Fri, 29 Jul 2005 22:30:13 -0400 (EDT) From: Bruce Momjian Message-Id: <200507300230.j6U2UDS27599@candle.pha.pa.us> Subject: Re: current_schemas() In-Reply-To: <20050705111440.62083.qmail@web52704.mail.yahoo.com> To: Halley Pacheco de Oliveira Date: Fri, 29 Jul 2005 22:30:13 -0400 (EDT) Cc: pgsql-docs@postgresql.org X-Mailer: ELM [version 2.4ME+ PL121 (25)] MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.01 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200507/33 X-Sequence-Number: 3159 Why not just use pg_catalog.current_schemas()? --------------------------------------------------------------------------- Halley Pacheco de Oliveira wrote: > I would like to know how to use current_schemas(), since SELECT current_schemas(); didn't work in > PostgreSQL 7.4 and 8.0 psql. > > Halley > > PostgreSQL 8.0.3 Documentation > Chapter 16. Server Run-time Environment > 16.4. Run-time Configuration > > The current effective value of the search path can be examined via the SQL function > current_schemas(). This is not quite the same as examining the value of search_path, since > current_schemas() shows how the requests appearing in search_path were resolved. > > teste=# \dn > ********* QUERY ********** > SELECT n.nspname AS "Name", > u.usename AS "Owner" > FROM pg_catalog.pg_namespace n LEFT JOIN pg_catalog.pg_user u > ON n.nspowner=u.usesysid > WHERE (n.nspname NOT LIKE 'pg\\_temp\\_%' OR > n.nspname = (pg_catalog.current_schemas(true))[1]) > ORDER BY 1; > ************************** > > List of schemas > Name | Owner > --------------------+---------- > information_schema | postgres > pg_catalog | postgres > pg_toast | postgres > public | postgres > (4 rows) > > teste=# SELECT current_schema(); > current_schema > ---------------- > public > (1 row) > > teste=# SELECT current_schemas(); > ERROR: function current_schemas() does not exist > HINT: No function matches the given name and argument types. You may need to add explicit type > casts. > > > > > > > > _______________________________________________________ > Yahoo! Acesso Gr?tis - Internet r?pida e gr?tis. > Instale o discador agora! http://br.acesso.yahoo.com/ > > ---------------------------(end of broadcast)--------------------------- > TIP 3: if posting/reading through Usenet, please send an appropriate > subscribe-nomail command to majordomo@postgresql.org so that your > message can get through to the mailing list cleanly > -- Bruce Momjian | http://candle.pha.pa.us pgman@candle.pha.pa.us | (610) 359-1001 + If your life is a hard drive, | 13 Roberts Road + Christ can be your backup. | Newtown Square, Pennsylvania 19073