Trigger with dynamic SQL

Поиск
Список
Период
Сортировка
От Josi Perez (3T Systems)
Тема Trigger with dynamic SQL
Дата
Msg-id AANLkTikTOkORnSAEa0dEk5x0TtB-Gt3TJqwUR-IxmohS@mail.gmail.com
обсуждение исходный текст
Ответы Re: Trigger with dynamic SQL  ("Josi Perez (3T Systems)" <josiperez3t@gmail.com>)
Re: Trigger with dynamic SQL  (Alex Hunsaker <badalex@gmail.com>)
Список pgsql-admin
To avoid to delete registers I created one trigger activated "before delete" with lines like that:
UPDATE tableX  set dtExc = 'now', userExc = current_user where idTableX = OLD.idTableX;
return NULL;

but, I need do the same for many tables and I don't catch how.
I created an sql variable to construct the update command using parameters on trigger
      qry := 'UPDATE '||arg_table||' set userexc = ' ||chr(39)||current_user||chr(39)||', dtalt = '||'''now'''||' where ' || arg_id ||' = OLD.'||TG_ARGV[1];

but when "EXECUTE qry" I lost the OLD.variable.

I can't send the bigint id to delete in trigger parameters.

Any suggestions?

Thanks in advance,
Josi Perez

#avg_ls_inline_popup { position:absolute; z-index:9999; padding: 0px 0px; margin-left: 0px; margin-top: 0px; width: 240px; overflow: hidden; word-wrap: break-word; color: black; font-size: 10px; text-align: left; line-height: 13px;}

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

Предыдущее
От: Ray Stell
Дата:
Сообщение: Re: could not truncate directory "pg_subtrans": apparent wraparound
Следующее
От: mnavahan
Дата:
Сообщение: Firebird To postgresql migration help needed