Обсуждение: Trigger transactions

Поиск
Список
Период
Сортировка

Trigger transactions

От
"Postgres User"
Дата:
if a function includes this SQL:

  Update Table1  Set field_1 = 'ab';
  Insert Table2(field_2) VALUES('cd');


and I create an update trigger on Table1:

  Create Trigger Table1_Update AFTER Update
  On Table1 FOR EACH ROW:

  Select * From Table2


will the Select statement in the trigger see the row that I inserted
in the main function?
if not, is there another way to write these statements to that it does?

thanks

Re: Trigger transactions

От
"Postgres User"
Дата:
Question answered- needed to move Insert statement before Update in
main function.

On Fri, Mar 21, 2008 at 6:42 PM, Postgres User
<postgres.developer@gmail.com> wrote:
> if a function includes this SQL:
>
>  Update Table1  Set field_1 = 'ab';
>  Insert Table2(field_2) VALUES('cd');
>
>
> and I create an update trigger on Table1:
>
>  Create Trigger Table1_Update AFTER Update
>  On Table1 FOR EACH ROW:
>
>  Select * From Table2
>
>
> will the Select statement in the trigger see the row that I inserted
> in the main function?
> if not, is there another way to write these statements to that it does?
>
> thanks
>