How to use RETURN TABLE in Postgres 8.4

From: Michal Szymanski <dyrex(at)poczta(dot)onet(dot)pl>
To: pgsql-general(at)postgresql(dot)org
Subject: How to use RETURN TABLE in Postgres 8.4
Date: 2009-07-03 10:52:56
Message-ID: 1c2c0453-6397-4217-bfbc-234589fff148@h11g2000yqb.googlegroups.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

I'written something like this:

CREATE TABLE "bug_table" (
"id" BIGINT NOT NULL,
test VARCHAR,
CONSTRAINT "test_table_pkey" PRIMARY KEY("id")
) WITHOUT OIDS;

INSERT INTO bug_table (id,test) VALUES (1,'test');
select * from bug_table;

CREATE OR REPLACE FUNCTION buggy_procedure() RETURNS TABLE (id INT8,
test VARCHAR)
AS $$
BEGIN
-- @todo hide password
RETURN QUERY
SELECT id ,test
FROM bug_table
;
END;
$$
LANGUAGE plpgsql STRICT SECURITY DEFINER;
SELECT * FROM buggy_procedure();

---------------------------
it returns 1 but empty row. What is wrong with this?

Regards
Michal Szymanski
http://blog.szymanskich.net

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Dimitri Fontaine 2009-07-03 10:53:44 Re: Group by on %like%
Previous Message Guy Flaherty 2009-07-03 10:37:22 Re: Group by on %like%