Re: [Bulk] Re: Final stored procedure question, for now anyway - Mailing list pgsql-general

From Guy Rouillier
Subject Re: [Bulk] Re: Final stored procedure question, for now anyway
Date
Msg-id CC1CF380F4D70844B01D45982E671B239E8DCA@mtxexch01.add0.masergy.com
Whole thread Raw
List pgsql-general
Ted Byers wrote:

>
> 2) Do I need to qualify my references to my tables in the function to
> identify the schema in which the tables exist, or will Postgres find
> the right tables with the function in its present form?  If I have to
> further qualify the table references, what is the correct
> qualification of the table references within the SQL in the function
> definition?

PostgreSQL uses a search path to find DB objects.  The default search
path is a schema with the same name you used to connect, followed by the
"public" schema.  You can alter this search path.  So you have several
options: (1) hard-code a schema name onto each table in your queries
(which I would never do and do not suggest), (2) put your DB objects
(tables, functions, etc) into the schema that you use to connect, or (3)
alter your search path.

As much as I like PG and as powerful as it is, I'm surprised the
designers have elected not to implement synonyms, which is how most
other databases address this issue.

--
Guy Rouillier


pgsql-general by date:

Previous
From: "Raymond O'Donnell"
Date:
Subject: Re: windows xp install problem ("failed to set
Next
From: Klein Balázs
Date:
Subject: alter column datatype with cast