Thread: current_schemas()

current_schemas()

From
Alvaro Herrera
Date:
Hello,

In http://developer.postgresql.org/docs/postgres/runtime-config.html,
the SEARCH_PATH variable description mentions the use of
current_schemas(), but this function doesn't exist (or it didn't exist
last time I updated:
#define CATALOG_VERSION_NO      200209021
)

What exists is current_schema(), but it doesn't expand to the full
search path; apparently, only the first item that exists:

testing=# set search_path to '$user', 'public', 'alvh1', 'alvh2';
SET
testing=# select current_schema();current_schema 
----------------public
(1 row)

This is not good:

testing=# \d foo     Table "alvh1.foo"Column |  Type   | Modifiers 
--------+---------+-----------a      | integer | not null
Indexes: foo_pkey primary key btree (a)

(and alvh1 does not appear on current_schema)

Is this a bug?

-- 
Alvaro Herrera (<alvherre[a]atentus.com>)
"Como puedes confiar en algo que pagas y que no ves,
y no confiar en algo que te dan y te lo muestran?" (German Poo)



Re: current_schemas()

From
Rod Taylor
Date:
On Sat, 2002-09-07 at 14:39, Alvaro Herrera wrote:
> Hello,
> 
> In http://developer.postgresql.org/docs/postgres/runtime-config.html,
> the SEARCH_PATH variable description mentions the use of
> current_schemas(), but this function doesn't exist (or it didn't exist
> last time I updated:
> #define CATALOG_VERSION_NO      200209021
> )
> 
> What exists is current_schema(), but it doesn't expand to the full
> search path; apparently, only the first item that exists:
> 
> testing=# set search_path to '$user', 'public', 'alvh1', 'alvh2';
> SET
> testing=# select current_schema();
>  current_schema 
> ----------------
>  public
> (1 row)

Heres what I get.  Note current_schemas() shows the full search path,
where current_schema() shows only the first.

a=# set search_path to k,l;
SET
a=# select current_schemas(true);current_schemas  
------------------{pg_catalog,k,l}
(1 row)





Re: current_schemas()

From
Alvaro Herrera
Date:
Rod Taylor dijo: 

> On Sat, 2002-09-07 at 14:39, Alvaro Herrera wrote:
> > Hello,
> > 
> > In http://developer.postgresql.org/docs/postgres/runtime-config.html,
> > the SEARCH_PATH variable description mentions the use of
> > current_schemas(), but this function doesn't exist (or it didn't exist
> 
> Heres what I get.  Note current_schemas() shows the full search path,
> where current_schema() shows only the first.

Oh, I see.  This seems like a bug in the documentation to me.  It should
have a cross-reference to the "miscellaneous functions" section, or
mention the usage of the parameter.

I think this is a global and serious bug in the SGML documentation: the
lack of cross references.  It seriously decreases the usability of the
documentation system.

-- 
Alvaro Herrera (<alvherre[a]atentus.com>)
"El destino baraja y nosotros jugamos" (A. Schopenhauer)