Skip site navigation (1) Skip section navigation (2)

Re: BUG #3628: Wrong schema picked

From: "Heikki Linnakangas" <heikki(at)enterprisedb(dot)com>
To: "Pedro Gimeno" <pgsql-001(at)personal(dot)formauri(dot)es>
Cc: <pgsql-bugs(at)postgresql(dot)org>
Subject: Re: BUG #3628: Wrong schema picked
Date: 2007-09-24 09:23:20
Message-ID: 46F78208.7040805@enterprisedb.com (view raw or flat)
Thread:
Lists: pgsql-bugs
Pedro Gimeno wrote:
> When a function has a SQL statement to execute that has an unqualified
> table, that SQL statement doesn't always pick the table from a schema in the
> search_path. 

The first time the function is run, all the statements in it are planned
and the schema used for the insert is resolved. Subsequent calls will
reuse the same plan. The obvious fix is to always explicitly specify the
schema in the INSERT. Or if if you want it to depend on the search_path,
you can execute it dynamically using EXECUTE
(http://www.postgresql.org/docs/8.2/static/plpgsql-statements.html#PLPGSQL-STATEMENTS-EXECUTING-DYN).

-- 
  Heikki Linnakangas
  EnterpriseDB   http://www.enterprisedb.com

In response to

Responses

pgsql-bugs by date

Next:From: Gregory StarkDate: 2007-09-24 12:00:06
Subject: Re: Memory Allocation Error
Previous:From: Heikki LinnakangasDate: 2007-09-24 09:14:21
Subject: Re: BUG #3627: Triple FK with ON DELETE SET NULL makes DELETE fail

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group