Iterating over rowtype/record fields?
| От | Bill Gribble |
|---|---|
| Тема | Iterating over rowtype/record fields? |
| Дата | |
| Msg-id | 1021554896.11133.12.camel@flophouse обсуждение исходный текст |
| Ответы |
Re: Iterating over rowtype/record fields?
|
| Список | pgsql-general |
I've looked online and in the 7.1 docs but I can't locate much
information about the RECORD type and what I can do with it from
pl/pgsql. Are there any introspection or iteration functions that would
allow me to look at all the columns in a record without explicitly
writing RECORD.column?
I'm trying to write a fairly generic pl/pgsql trigger function to log
changes to a specified set of tables into another table. So I can
easily get a NEW and OLD record, but in the generic case I don't know
what type of table they represent. I'd like to just say something like
FOR f IN table%ROWTYPE LOOP
IF OLD.f != NEW.f THEN
make_log_entry(table, NEW.rownum, f, NEW.f);
END IF
END LOOP
don't think that works tho :)
Any ideas how I can do something like the above?
Thanks,
Bill Gribble
В списке pgsql-general по дате отправления: