BUG #1277: plpgsql EXECUTE bug in beta3

From: "PostgreSQL Bugs List" <pgsql-bugs(at)postgresql(dot)org>
To: pgsql-bugs(at)postgresql(dot)org
Subject: BUG #1277: plpgsql EXECUTE bug in beta3
Date: 2004-10-04 06:10:04
Message-ID: 20041004061004.E47C95A105B@www.postgresql.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs


The following bug has been logged online:

Bug reference: 1277
Logged by: Tom Hebbron

Email address: news_user(at)hebbron(dot)com

PostgreSQL version: 8.0 Beta

Operating system: n/a

Description: plpgsql EXECUTE bug in beta3

Details:

In beta2, the following script runs as expected:

--begin SQL script
drop table a cascade;

create or replace function execute_sql(text) returns void AS $$begin execute
$1; return; end; $$ language plpgsql;

select execute_sql('create table a (i integer); insert into a(i)
values(1);');

select * from a;
--eof SQL script

The create table and insert commands are executed OK, and table 'a' contains
a single row with value 1 in the column i.

Under beta3, the following behaviour is observed:

test=# drop table a cascade;
ERROR: table "a" does not exist
test=#
test=# create or replace function execute_sql(text) returns void AS $$begin
execute $1; return; end; $$ language plpgsql;
CREATE FUNCTION
test=#
test=# select execute_sql('create table a (i integer); insert into a(i)
values(1);');
ERROR: relation "a" does not exist
CONTEXT: SQL query "create table a (i integer); insert into a(i)
values(1);"
PL/pgSQL function "execute_sql" line 1 at execute statement
test=#
test=# select * from a;
ERROR: relation "a" does not exist
test=#

As demonstrated, some change in the plpgsql EXECUTE handler between beta2
and beta3 has caused multiple statement EXECUTE calls to be unable to see
the effects of earlier statements in the same EXECUTE call.

calling select execute_sql('begin; create table a (i integer); insert into
a(i) values(1); commit;');

has the same results.

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Sean Chittenden 2004-10-04 07:11:06
Previous Message Cherry Ann Alib 2004-10-04 05:55:50 initdb fails