[BUGS] BUG #6686: plpgsql Can't assign a variable with the output of a SQL Sentence which is not a SELECT

2012-06-10 Thread stormbyte
The following bug has been logged on the website: Bug reference: 6686 Logged by: David Carlos Manuelda Email address: stormb...@gmail.com PostgreSQL version: 9.1.4 Operating system: Gentoo Linux Description: I will provide a really simple example: Suppose we have a

Re: [BUGS] BUG #6686: plpgsql Can't assign a variable with the output of a SQL Sentence which is not a SELECT

2012-06-10 Thread Kevin Grittner
wrote: CREATE OR REPLACE FUNCTION foo() RETURNS INTEGER AS $$ DECLARE dummy INTEGER; BEGIN dummy=(SELECT MAX(id) FROM test); -- VALID dummy=(UPDATE test SET i=i+10 RETURNING i); -- NOT VALID.. WHY? dummy=(INSERT INTO test(i) VALUES (10) RETURNING i); -- NOT VALID.. WHY? RETURN dummy;