Re: Using a tablename as a parameter to a function.

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: ingram(at)samsix(dot)com
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: Using a tablename as a parameter to a function.
Date: 2001-12-20 23:33:35
Message-ID: 11888.1008891215@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

Stephen Ingram <ingram(at)samsix(dot)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

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message denis 2001-12-21 06:05:33 concating numeric with text
Previous Message Tom Lane 2001-12-20 23:31:47 Re: Trigger question