Re: How to use RETURN TABLE in Postgres 8.4 - Mailing list pgsql-general

From Tom Lane
Subject Re: How to use RETURN TABLE in Postgres 8.4
Date
Msg-id 1704.1246635998@sss.pgh.pa.us
Whole thread Raw
In response to How to use RETURN TABLE in Postgres 8.4  (Michal Szymanski <dyrex@poczta.onet.pl>)
Responses Re: How to use RETURN TABLE in Postgres 8.4
List pgsql-general
Michal Szymanski <dyrex@poczta.onet.pl> writes:
> 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;

Don't use column names in your functions that are the same as variable
or parameter names of the function.  This is working basically as if
you'd written "SELECT null,null", because the output parameters are
still null when the RETURN QUERY is executed.

            regards, tom lane

pgsql-general by date:

Previous
From: Vanessa Lopez
Date:
Subject: REINDEX "is not a btree"
Next
From: Pavel Stehule
Date:
Subject: Re: How to use RETURN TABLE in Postgres 8.4