Re: Using a tablename as a parameter to a function. - Mailing list pgsql-novice

From Tom Lane
Subject Re: Using a tablename as a parameter to a function.
Date
Msg-id 11888.1008891215@sss.pgh.pa.us
Whole thread Raw
In response to Using a tablename as a parameter to a function.  (Stephen Ingram <ingram@samsix.com>)
List pgsql-novice
Stephen Ingram <ingram@samsix.com> writes:
> Is it possible (legal syntax, I mean) to pass a tablename
> as a parameter to a function?

You could pass the tablename as a string argument (eg, text or varchar)
and then construct your queries as strings for plpgsql's EXECUTE
function.  This is notationally tedious, and you lose some performance
because there's no possibility to cache and reuse query plans, but
it will work.

            regards, tom lane

pgsql-novice by date:

Previous
From: Tom Lane
Date:
Subject: Re: Trigger question
Next
From: Pat Marchant
Date:
Subject: Re: Trigger question