Re: [HACKERS] DDL+SQL in PL/pgSQL EXECUTE

2009-03-18 Thread Tom Lane
Vlad Arkhipov writes: > 3. ERROR: relation "t" does not exist > SELECT _EXEC('CREATE TABLE T(ID INTEGER); INSERT INTO T(ID) VALUES (1)'); > 4. Inserts NULL value into ID column instead of default 10. > BEGIN WORK; > CREATE TABLE T(ID INTEGER); > SELECT _EXEC('ALTER TABLE T ALTER COLUMN ID SET DE

[HACKERS] DDL+SQL in PL/pgSQL EXECUTE

2009-03-18 Thread Vlad Arkhipov
Is it a bug or by design? I could not find what behaviour is correct for these statements in PL/pgSQL: This function just executes a string. CREATE OR REPLACE FUNCTION _EXEC(query VARCHAR) RETURNS VOID AS $$ BEGIN EXECUTE query; END; $$ LANGUAGE 'plpgsql'; 1. Works ok. BEGIN WORK; SELECT _EXEC