Search Postgresql Archives

How to use RETURN TABLE in Postgres 8.4

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux