From: | "Michal szymanski" <szymanskim(at)datera(dot)pl> |
---|---|
To: | pgsql-bugs(at)postgresql(dot)org |
Subject: | BUG #4516: FOUND variable does not work after RETURN QUERY |
Date: | 2008-11-06 16:38:12 |
Message-ID: | 200811061638.mA6GcCgp057944@wwwmaster.postgresql.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs pgsql-hackers |
The following bug has been logged online:
Bug reference: 4516
Logged by: Michal szymanski
Email address: szymanskim(at)datera(dot)pl
PostgreSQL version: 8.3
Operating system: Windows
Description: FOUND variable does not work after RETURN QUERY
Details:
This short program display two rows instead one. If I use RETURN NEXT it
works.
CREATE TABLE test_table (
value VARCHAR
);
INSERT INTO test_table VALUES ('a');
INSERT INTO test_table VALUES ('b');
CREATE OR REPLACE FUNCTION test()
RETURNS SETOF test_table AS
$BODY$
DECLARE
BEGIN
RETURN QUERY
SELECT * FROM test_table WHERE value='a';
IF NOT FOUND THEN
RETURN QUERY
SELECT * FROM test_table WHERE value='b';
END IF;
RETURN;
END;
$BODY$
LANGUAGE 'plpgsql' VOLATILE;
select * from test()
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2008-11-06 17:22:51 | Re: BUG #4516: FOUND variable does not work after RETURN QUERY |
Previous Message | Alex Hunsaker | 2008-11-06 16:25:24 | Re: plperl & sort |
From | Date | Subject | |
---|---|---|---|
Next Message | Kevin Grittner | 2008-11-06 16:38:37 | Re: RAM-only temporary tables |
Previous Message | Ron Mayer | 2008-11-06 16:35:39 | Re: Patch for ISO-8601-Interval Input and output. |