From: | "Preston M(dot) Price" <preston(at)clearwateranalytics(dot)com> |
---|---|
To: | pgsql-bugs(at)postgresql(dot)org |
Subject: | BUG #6031: Bug with plpgsql function and RETURNS TABLE |
Date: | 2011-05-20 16:12:09 |
Message-ID: | 201105201612.p4KGC9Cx027071@wwwmaster.postgresql.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs |
The following bug has been logged online:
Bug reference: 6031
Logged by: Preston M. Price
Email address: preston(at)clearwateranalytics(dot)com
PostgreSQL version: 8.4
Operating system: Linux (Ubuntu)
Description: Bug with plpgsql function and RETURNS TABLE
Details:
If I create a plpgsql function and use RETURNS TABLE
the returned result set is filled with null values rather than the values
from the table.
---SETUP---
create table test
(
ID SERIAL PRIMARY KEY,
VAL INT NOT NULL
);
INSERT INTO TEST(VAL) VALUES(1);
INSERT INTO TEST(VAL) VALUES(2);
INSERT INTO TEST(VAL) VALUES(3);
INSERT INTO TEST(VAL) VALUES(4);
INSERT INTO TEST(VAL) VALUES(5);
CREATE FUNCTION TEST_FUNC() RETURNS TABLE(val int) AS $$
BEGIN
RETURN QUERY SELECT VAL FROM test;
END;
$$ LANGUAGE plpgsql;
---SETUP---
select * from TEST_FUNC();
This query yields 5 rows of null rather than the values from the test table.
From | Date | Subject | |
---|---|---|---|
Next Message | Alvaro Herrera | 2011-05-20 20:15:58 | Re: BUG #6031: Bug with plpgsql function and RETURNS TABLE |
Previous Message | Koichi Suzuki | 2011-05-20 14:06:44 | Invitation to connect on LinkedIn |