I have a behaviour similar to this
http://archives.postgresql.org/pgsql-bugs/2007-09/msg00017.php
create language plpgsql;
create schema test1;
create schema test2;
create table test1.a(a varchar(3) unique);
create table test2.a(a varchar(3) unique);
create or replace function test_insert() returns void as
$$
begin
raise notice 'path %', current_schemas(true);
insert into a values('a');
end;
$$ language plpgsql volatile;
set search_path to 'test1', 'public';
select * from test_insert();
NOTICE: path {pg_catalog,test1,public}
test_insert
-------------
(1 row)
set search_path to 'test2', 'public';
select * from test_insert();
NOTICE: path {pg_catalog,test2,public}
ERROR: duplicate key value violates unique constraint "a_a_key"
CONTEXT: SQL statement "insert into a values('a')"
PL/pgSQL function "test_insert" line 3 at SQL statement
PostgreSQL 8.3.14
what's going on?
--
Ivan Sergio Borgonovo
http://www.webthatworks.it