Dynamic column name troubles

Started by Nonameabout 21 years ago2 messagesgeneral
Jump to latest
#1Noname
mstory@uchicago.edu

I have a table that gets a column added to it for every insert on another table.
the general form of these columns are g_c_i_avg where i is the unique
identifyer for the insert that caused the column to be added. I need to use this
column to calculate a new value for another column in the same table on an
update to that column. I can find the altered column, and even build a text
string for it: something like column := ''NEW.g_c_'' || 7 || ''_avg'';

but then i can't use the double precision value for that column. Any help would
be appreciated.

matt

#2Bruce Momjian
bruce@momjian.us
In reply to: Noname (#1)
Re: Dynamic column name troubles

mstory@uchicago.edu writes:

I have a table that gets a column added to it for every insert on another table.

I think you're going to run into a lot of problems with something like that.
Perhaps you should describe the original problem you're trying to solve and
people would be able to suggest another approach.

--
greg