How can I use a dynamic column name after NEW. or OLD. in trigger procedure?
| От | Peter Devoy |
|---|---|
| Тема | How can I use a dynamic column name after NEW. or OLD. in trigger procedure? |
| Дата | |
| Msg-id | CABoFc_h9uavYu_7q6AyVMcdzjVwxaZSgGnca-dAY-TeO4xupbA@mail.gmail.com обсуждение исходный текст |
| Ответы |
Re: How can I use a dynamic column name after NEW. or OLD.
in trigger procedure?
Re: How can I use a dynamic column name after NEW. or OLD. in trigger procedure? Re: How can I use a dynamic column name after NEW. or OLD. in trigger procedure? |
| Список | pgsql-general |
As part of the extension I am writing I am trying to create a trigger
procedure in which the value of the primary key of the NEW or OLD row
is used. The trigger will be fired by arbitrary tables so the column
name must be dynamic. Something like:
pk_column := 'foo_id'; --example assignment only
EXECUTE 'INSERT INTO bar (baz) VALUES ($1)'
USING NEW.quote_literal(pk_column);
Out of desperation I have pretty much brute forced many weird
combinations of quote_literal, quote_ident, ::regclass, || and USING.
Unfortunately, I have not been able to get anything to work so any
help would be very much appreciated.
Thanks for reading
Peter Devoy
В списке pgsql-general по дате отправления: