Re: function to update different tables - Mailing list pgsql-novice

From Tom Lane
Subject Re: function to update different tables
Date
Msg-id 26018.1099879691@sss.pgh.pa.us
Whole thread Raw
In response to function to update different tables  ("Lars Eckberg" <le@eckbergconsulting.com>)
List pgsql-novice
"Lars Eckberg" <le@eckbergconsulting.com> writes:
> I'm trying to create a function, where the first parameter will be the
> tablename to update.

There is no way to do that in an SQL-language function.  If you use
plpgsql then it's possible to construct an SQL command as a string
(ie, concatenate the constant parts with the table name) and then
execute it with an EXECUTE statement.

            regards, tom lane

pgsql-novice by date:

Previous
From: "Lars Eckberg"
Date:
Subject: function to update different tables
Next
From:
Date:
Subject: Pgsql install