Thread: schema 8.1.5

schema 8.1.5

From
km
Date:
Hi all,

Have a general doubt abt default  schema public  in postgresql 8.1.5:

i would like to know if for every database a valid user creates, postgreSQL by default creates a public schema which is
optional?  

Also is it possible to know which schema i am currently in ?

how do i  set a user account to default to a predefined schema  ?

i have tried :
SET search_path TO myschema;
but thats temprary setting i suppose.

so that when the user logis in and accesses a database via psql he should be able to land into his schema. how do i do
that? any tips ? 

regards,
KM


Re: schema 8.1.5

From
Alan Hodgson
Date:
On Thursday 26 October 2006 14:04, km <km@mrna.tn.nic.in> wrote:
>> so that when the user logis in and accesses a database via psql he should
> be able to land into his schema. how do i do that ? any tips ?

alter role rolename set search_path=path1[,path2...];

--
Ginsberg's Theorem:
 1) You can't win.
 2) You can't break even.
 3) You can't quit the game.


Re: schema 8.1.5

From
Tom Lane
Date:
km <km@mrna.tn.nic.in> writes:
> how do i  set a user account to default to a predefined schema  ?

If you make the choice user name = schema name, this happens for free.
See
http://www.postgresql.org/docs/8.1/static/ddl-schemas.html
The bit about common usage patterns might help in particular.

> i have tried :
> SET search_path TO myschema;
> but thats temprary setting i suppose.

Doesn't have to be.  See postgresql.conf and ALTER USER.

            regards, tom lane