The following bug has been logged online:
Bug reference: 6031
Logged by: Preston M. Price
Email address: [email protected]
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.
--
Sent via pgsql-bugs mailing list ([email protected])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs