Re: why SELECT query needs relationname (schemaName.tableName)

From: Samuel Gendler <sgendler(at)ideasculptor(dot)com>
To: Amar Dhole <adhole(at)tibco(dot)com>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: why SELECT query needs relationname (schemaName.tableName)
Date: 2011-02-08 07:16:04
Message-ID: AANLkTikH1EbYkwbt7Vn_cfoHix2BVhftBdqeyco5qu8V@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

You need to modify the search_path for that user. Read the first section of
this page very carefully:
http://www.postgresql.org/docs/8.4/static/runtime-config-client.html

The schema that is used for new objects that don't have an explicit schema
is always the first schema in the search_path.

You can permanently alter the search_path for the user like this:

alter user <username> set search_path to cust, other_schema, public,
pg_catalog;

There's more info on search_path here:
http://www.postgresql.org/docs/8.4/static/ddl-schemas.html

On Mon, Feb 7, 2011 at 10:56 PM, Amar Dhole <adhole(at)tibco(dot)com> wrote:

> Hi All,
>
>
>
> I have a query regarding database.
>
>
>
> I have database ‘customer’ which is having schema ‘cust.’
>
>
>
> I have added my tables and data into ‘cust’. But when I try to run the sql
> queries against this schema I need to add ‘cust’ as a relationName for every
> query. But same is not applicable for public schema.
>
>
>
> Same is applicable when I query with jdbc.
>
>
>
> Can any one guide me how can I make my ‘cust’ schema to work like public
> schema means for all the sqls I don’t need to append schema name as
> relationanme.
>
>
> Thanks
>
> Amar
>

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Gavin Beau Baumanis 2011-02-08 10:03:01 UTF characters compromising data import.
Previous Message Amar Dhole 2011-02-08 06:56:45 why SELECT query needs relationname (schemaName.tableName)