From: Alvaro Herrera <alvherre@commandprompt.com>
To: Masis, Alexander (US SSA) <alexander.masis@baesystems.com>
Cc: pgsql-interfaces@postgresql.org
Subject: Re: schema name in the SQL statement.
Date: Wed, 20 Aug 2008 08:59:57 -0400
Message-ID: <20080820125957.GB4169@alvh.no-ip.org> (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?
You can change the database so that everybody connecting to it will use
that schema:
ALTER DATABASE your_db SET search_path = 'schema_1';
You can do that per-user, too:
ALTER DATABASE username SET search_path = 'schema_1';
You can also change it in the application, by sending
SET search_path TO 'schema_1';
There are other options too, but that should suffice.
--
Alvaro Herrera http://www.CommandPrompt.com/
PostgreSQL Replication, Consulting, Custom Development, 24x7 support
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: alvherre@commandprompt.com, alexander.masis@baesystems.com
Subject: Re: schema name in the SQL statement.
In-Reply-To: <20080820125957.GB4169@alvh.no-ip.org>
* 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