FAQ
I am new to Postgresql and was wondering if it is possible to create an ad-hoc select query function, where the table name, and the where clause were passed to the function and it returned a result set for the table?

Thanks
Roy

Search Discussions

  • Terry Lee Tucker at Jun 3, 2006 at 7:09 pm
    On Saturday 03 June 2006 02:17 pm, "Roy W Bradley" <[email protected]> thus
    communicated:
    --> I am new to Postgresql and was wondering if it is possible to create an
    ad-hoc select query function, where the table name, and the where clause
    were passed to the function and it returned a result set for the table? -->
    --> Thanks
    --> Roy
    -->

    You can generate dynamic SELECT statements. See the docs at:
    http://www.postgresql.org/docs/8.1/static/plpgsql-statements.html#PLPGSQL-STATEMENTS-EXECUTING-DYN
  • Bruno Wolff III at Jun 4, 2006 at 12:09 am

    On Sat, Jun 03, 2006 at 11:17:45 -0700, Roy W Bradley wrote:
    I am new to Postgresql and was wondering if it is possible to create an ad-hoc select query function, where the table name, and the where clause were passed to the function and it returned a result set for the table?
    Yes. You should be able to do this in most of not all of the PLs. A good
    start is to read this:
    http://developer.postgresql.org/docs/postgres/plpgsql-statements.html#PLPGSQL-STATEMENTS-EXECUTING-DYN

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouppgsql-novice @
categoriespostgresql
postedJun 3, '06 at 6:55p
activeJun 4, '06 at 12:09a
posts3
users3
websitepostgresql.org
irc#postgresql

People

Translate

site design / logo © 2023 Grokbase