BUG #3229: Incorrect temp table work

Started by Alexey Parshinabout 19 years ago2 messagesbugs
Jump to latest
#1Alexey Parshin
alexeyp@gmail.com

The following bug has been logged online:

Bug reference: 3229
Logged by: ALEXEY PARSHIN
Email address: alexeyp@gmail.com
PostgreSQL version: 8.1.8
Operating system: Gentoo Linux
Description: Incorrect temp table work
Details:

If I call the following function two or more time, I get an error "relation
with OID 318730 does not exist":

CREATE OR REPLACE FUNCTION temp_test(
) RETURNS void AS $$
BEGIN

BEGIN
CREATE TEMP TABLE session_info(
si_person int not null,
si_person_name varchar(40) not null,
si_server int not null
);
EXCEPTION
-- Table already exists? Clean it
WHEN others THEN
DELETE FROM session_info;
END;

INSERT INTO session_info (si_person,si_person_name,si_server)
VALUES (1,'test',1);

RAISE EXCEPTION 'Something went wrong';
END;
$$ LANGUAGE 'plpgsql';
----------------------------------------------------------------------------
----
GRANT EXECUTE ON FUNCTION temp_test() TO PUBLIC;

#2Stefan Kaltenbrunner
stefan@kaltenbrunner.cc
In reply to: Alexey Parshin (#1)
Re: BUG #3229: Incorrect temp table work

ALEXEY PARSHIN wrote:

The following bug has been logged online:

Bug reference: 3229
Logged by: ALEXEY PARSHIN
Email address: alexeyp@gmail.com
PostgreSQL version: 8.1.8
Operating system: Gentoo Linux
Description: Incorrect temp table work
Details:

If I call the following function two or more time, I get an error "relation
with OID 318730 does not exist":

this is documented (and a workaround is mentioned as well) in the FAQ:
http://www.postgresql.org/docs/faqs.FAQ.html#item4.19

and this will get improved (through plan invalidation) in the upcoming
8.3 release of postgresql too in a way that will not require the EXECUTE
workaround any more.

Stefan