[TRIGGER] Returning values from BEFORE UPDATE trigger, without using them

Поиск
Список
Период
Сортировка
От Torsten Zühlsdorff
Тема [TRIGGER] Returning values from BEFORE UPDATE trigger, without using them
Дата
Msg-id i2c3bp$v3l$1@news.eternal-september.org
обсуждение исходный текст
Ответы Re: [TRIGGER] Returning values from BEFORE UPDATE trigger, without using them  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-sql
Hello,

i have a non-trival problem and i do not believe that it is solvable.

I have defined an BEFORE UPDATE trigger. The trigger catch every update, 
change some columns of the new row, make an insert of the new row and 
returns null to abort the update.
All fine till here :)

Now the problem: if i do an UPDATE table [..] RETURNING * it returns 
always null. This is correct behavior, because the UPDATE is canceld by 
the trigger which returns null, so the updated data is "null".
But i want to get the new data inserted by the trigger without a new 
select. Is there a possibility to get the inserted data or do i have to 
do a select after the update?

Greetings,
Torsten
-- 
http://www.dddbl.de - ein Datenbank-Layer, der die Arbeit mit 8 
verschiedenen Datenbanksystemen abstrahiert,
Queries von Applikationen trennt und automatisch die Query-Ergebnisse 
auswerten kann.


В списке pgsql-sql по дате отправления:

Предыдущее
От: Richard Huxton
Дата:
Сообщение: Re: Aggregates (last/first) not behaving
Следующее
От: Andreas
Дата:
Сообщение: howto delete using a join ?