plpgsql RETURN QUERY EXECUTE

From: "Pavel Stehule" <pavel(dot)stehule(at)gmail(dot)com>
To: pgsql-patches <pgsql-patches(at)postgresql(dot)org>
Subject: plpgsql RETURN QUERY EXECUTE
Date: 2008-04-05 12:03:23
Message-ID: 162867790804050503p5af491d2ga3dc17de7a96c0dd@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-patches

Hello

This patch allows dynamic queries in RETURN QUERY statement.

http://archives.postgresql.org/pgsql-hackers/2008-02/msg01180.php

Sample:

CREATE OR REPLACE FUNCTION test(tab varchar, b integer)
RETURNS SETOF integer AS $$
BEGIN
RETURN QUERY
EXECUTE 'SELECT a FROM ' || tab 'WHERE b = $1'
USING b;
RETURN;
END;
$$ LANGUAGE plpgsql;

Regards
Pavel Stehule

Attachment Content-Type Size
return_query_execute.diff text/x-patch 14.8 KB

Responses

Browse pgsql-patches by date

  From Date Subject
Next Message Merlin Moncure 2008-04-05 14:15:32 Re: libpq type system 0.9a
Previous Message Pavel Stehule 2008-04-05 11:57:59 plpgsql CASE statement - last version