Skip site navigation (1) Skip section navigation (2)

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 (view raw or flat)
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: return_query_execute.diff
Description: text/x-patch (14.8 KB)

Responses

pgsql-patches by date

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

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group