pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
How can I set a default schema for a session
3+ messages / 3 participants
[nested] [flat]

* How can I set a default schema for a session
@ 2003-07-22 20:52  Dilan Arumainathan <dilan_a@impark.com>
  0 siblings, 2 replies; 3+ messages in thread

From: Dilan Arumainathan @ 2003-07-22 20:52 UTC (permalink / raw)
  To: pgsql-admin

Hi,
Every time I have to specify a table name in a query I find myself prefixing
the name of the table with the schema name as in schema.table. Is there a
way to force the queries to look in one particular schema whenever I do not
specify a schema name?

thanks
dilan




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

* Re: How can I set a default schema for a session
@ 2003-07-22 20:56  scott.marlowe <scott.marlowe@ihs.com>
  parent: Dilan Arumainathan <dilan_a@impark.com>
  1 sibling, 0 replies; 3+ messages in thread

From: scott.marlowe @ 2003-07-22 20:56 UTC (permalink / raw)
  To: Dilan Arumainathan <dilan_a@impark.com>; +Cc: pgsql-admin

On Tue, 22 Jul 2003, Dilan Arumainathan wrote:

> Hi,
> Every time I have to specify a table name in a query I find myself prefixing
> the name of the table with the schema name as in schema.table. Is there a
> way to force the queries to look in one particular schema whenever I do not
> specify a schema name?

Just change search_path to include it:

psql
> set search_path=$user,public,mynewschema;






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

* Re: How can I set a default schema for a session
@ 2003-07-22 21:18  Ian Barwick <barwick@gmx.net>
  parent: Dilan Arumainathan <dilan_a@impark.com>
  1 sibling, 0 replies; 3+ messages in thread

From: Ian Barwick @ 2003-07-22 21:18 UTC (permalink / raw)
  To: Dilan Arumainathan <dilan_a@impark.com>; pgsql-admin

On Tuesday 22 July 2003 22:52, Dilan Arumainathan wrote:
> Hi,
> Every time I have to specify a table name in a query I find myself
> prefixing the name of the table with the schema name as in schema.table. Is
> there a way to force the queries to look in one particular schema whenever
> I do not specify a schema name?

SET search_path TO ...

http://www.postgresql.org/docs/7.3/static/ddl-schemas.html

You can also use 

ALTER USER user_name SET search_path to ...;

to make the setting permanent.


Ian Barwick
barwick@gmx.net




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


end of thread, other threads:[~2003-07-22 21:18 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2003-07-22 20:52 How can I set a default schema for a session Dilan Arumainathan <dilan_a@impark.com>
2003-07-22 20:56 ` scott.marlowe <scott.marlowe@ihs.com>
2003-07-22 21:18 ` Ian Barwick <barwick@gmx.net>

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