pg.ddx.io  pgsql-interfaces@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Bosco Rama <postgres@boscorama.com>
To: pgsql-interfaces@postgresql.org
Subject: Re: schema name in the SQL statement.
Date: Wed, 20 Aug 2008 09:39:55 -0700
Message-ID: <48AC48DB.6020603@boscorama.com> (raw)
In-Reply-To: <738m08$3l61o@dmzms99802.na.baesystems.com>
References: <738m08$3l61o@dmzms99802.na.baesystems.com>

Masis, Alexander (US SSA) wrote:
> My db has one schema. In fact I deleted the default "public" and created
> my own: "schema_1".
> In my SQL query I have to explicitly specify schema name:
> "select my_colomn from schema_1.table_name;"
> Can't schema be specified as default value during connection, or can I
> set the schema before I send the query?

After the connection is established, set the search_path to be your
schema:
   "set search_path to schema_1;"

At that point you can use unqualified relation references again:
   "select my_colomn from table_name;"


Bosco.



view thread (3+ messages)

Message-ID: <48AC48DB.6020603@boscorama.com>
Permalink:  ../48AC48DB.6020603@boscorama.com/
Also on:    postgresql.org/message-id/48AC48DB.6020603@boscorama.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-interfaces@postgresql.org
  Cc: postgres@boscorama.com
  Subject: Re: schema name in the SQL statement.
  In-Reply-To: <48AC48DB.6020603@boscorama.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

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