BUG #6031: Bug with plpgsql function and RETURNS TABLE
| От | Preston M. Price |
|---|---|
| Тема | BUG #6031: Bug with plpgsql function and RETURNS TABLE |
| Дата | |
| Msg-id | 201105201612.p4KGC9Cx027071@wwwmaster.postgresql.org обсуждение |
| Ответы |
Re: BUG #6031: Bug with plpgsql function and RETURNS TABLE
|
| Список | pgsql-bugs |
The following bug has been logged online:
Bug reference: 6031
Logged by: Preston M. Price
Email address: preston@clearwateranalytics.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.
В списке pgsql-bugs по дате отправления: