function doesn't see change in search_path

Поиск
Список
Период
Сортировка
От Ivan Sergio Borgonovo
Тема function doesn't see change in search_path
Дата
Msg-id 20111107154308.2b363b14@dawn.webthatworks.it
обсуждение исходный текст
Ответы Re: function doesn't see change in search_path  (Richard Huxton <dev@archonet.com>)
Список pgsql-general
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


В списке pgsql-general по дате отправления:

Предыдущее
От: Merlin Moncure
Дата:
Сообщение: Re: PostgreSQL references in the Middle East
Следующее
От: Richard Broersma
Дата:
Сообщение: Re: Custom Contraint Violation Errors