Thread: BUG #8580: search_path unexpected behavior with pg_temp

BUG #8580: search_path unexpected behavior with pg_temp

From
bashtanov@imap.cc
Date:
The following bug has been logged on the website:

Bug reference:      8580
Logged by:          Alexey Bashtanov
Email address:      bashtanov@imap.cc
PostgreSQL version: 9.2.4
Operating system:   Linux Centos 6.4
Description:

[STEPS TO REPRODUCE]
CREATE OR REPLACE FUNCTION foo() RETURNS void
AS $$
begin
  create temporary table zoo () on commit preserve rows;
  delete from zoo;
  drop table zoo;
end;
$$ language plpgsql set search_path = pg_catalog, public, pg_temp;


begin;
select foo();
abort;
begin;
select foo();


[EXPECTED]
no errors
[RECEIVED]
ERROR:  relation "zoo" does not exist
LINE 1: delete from zoo


[ALSO]
1)reproducibility between 50% and 100%
2)also can be reproduced on pg 9.1.9
3)reproduced if replace delete by perform
4)not reproduced if replace delete by alter


Regards,
  Alexey Bashtanov