public inbox for [email protected]  
help / color / mirror / Atom feed
current_schemas()
4+ messages / 4 participants
[nested] [flat]

* current_schemas()
@ 2005-07-05 11:14  Halley Pacheco de Oliveira <[email protected]>
  0 siblings, 2 replies; 4+ messages in thread

From: Halley Pacheco de Oliveira @ 2005-07-05 11:14 UTC (permalink / raw)
  To: pgsql-docs

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/



^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: current_schemas()
@ 2005-07-05 14:06  Alvaro Herrera <[email protected]>
  parent: Halley Pacheco de Oliveira <[email protected]>
  1 sibling, 0 replies; 4+ messages in thread

From: Alvaro Herrera @ 2005-07-05 14:06 UTC (permalink / raw)
  To: Halley Pacheco de Oliveira <[email protected]>; +Cc: pgsql-docs

On Tue, Jul 05, 2005 at 08:14:40AM -0300, Halley Pacheco de Oliveira wrote:

> 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.

alvherre=# select current_schemas(true);
   current_schemas   
---------------------
 {pg_catalog,public}
(1 fila)

alvherre=# select current_schemas(false);
 current_schemas 
-----------------
 {public}
(1 fila)


Function parameters are essential when determining if a function exists
or not.

alvherre=# \df current_schema*
                                 Listado de funciones
   Schema   |     Nombre      | Tipo de dato de salida | Tipos de datos de argumentos 
------------+-----------------+------------------------+------------------------------
 pg_catalog | current_schema  | name                   | 
 pg_catalog | current_schemas | name[]                 | boolean
(2 filas)

-- 
Alvaro Herrera (<alvherre[a]surnet.cl>)
FOO MANE PADME HUM



^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: current_schemas()
@ 2005-07-30 02:30  Bruce Momjian <[email protected]>
  parent: Halley Pacheco de Oliveira <[email protected]>
  1 sibling, 1 reply; 4+ messages in thread

From: Bruce Momjian @ 2005-07-30 02:30 UTC (permalink / raw)
  To: Halley Pacheco de Oliveira <[email protected]>; +Cc: pgsql-docs


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 [email protected] so that your
>        message can get through to the mailing list cleanly
> 

-- 
  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



^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: current_schemas()
@ 2005-07-30 03:21  Alvaro Herrera <[email protected]>
  parent: Bruce Momjian <[email protected]>
  0 siblings, 0 replies; 4+ messages in thread

From: Alvaro Herrera @ 2005-07-30 03:21 UTC (permalink / raw)
  To: Bruce Momjian <[email protected]>; +Cc: Halley Pacheco de Oliveira <[email protected]>; pgsql-docs

On Fri, Jul 29, 2005 at 10:30:13PM -0400, Bruce Momjian wrote:
> 
> Why not just use pg_catalog.current_schemas()?

The function is current_schemas(bool), that's why this example doesn't
work:

> > 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.

-- 
Alvaro Herrera (<alvherre[a]alvh.no-ip.org>)
"Aprende a avergonzarte más ante ti que ante los demás" (Demócrito)




^ permalink  raw  reply  [nested|flat] 4+ messages in thread


end of thread, other threads:[~2005-07-30 03:21 UTC | newest]

Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2005-07-05 11:14 current_schemas() Halley Pacheco de Oliveira <[email protected]>
2005-07-05 14:06 ` Alvaro Herrera <[email protected]>
2005-07-30 02:30 ` Bruce Momjian <[email protected]>
2005-07-30 03:21   ` Alvaro Herrera <[email protected]>

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox