Trigger (Transaction related)

Поиск
Список
Период
Сортировка
От Harpreet Dhaliwal
Тема Trigger (Transaction related)
Дата
Msg-id d86a77ef0608312351h175bede8v2d537380f096c10d@mail.gmail.com
обсуждение исходный текст
Ответы Re: Trigger (Transaction related)  (Martijn van Oosterhout <kleptog@svana.org>)
Re: Trigger (Transaction related)  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-general
Hi,
I've written a trigger after insert on a table (parser) and the trigger calls a function that dynamically loads a shared object written in C.

This shared object intends to use the newly inserted row in the table on which trigger is written and insert values in another table, something like this,

sprintf(buffer, "INSERT INTO headers (id, header_content) VALUES ( %d, SELECT contents FROM parser WHERE id = %d ), id, id);
SPI_exec(buffer,0).

Above line of code is not able to read the values of newly inserted code i.e
SELECT contents FROM parser WHERE id = %d
and throws an error.

Is it because its still the same transaction going on and the insert fired on parser talbe won't be reflected in the select query in the shared object which is a part of the same transaction???

Regards,

~Harpreet


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

Предыдущее
От: Martijn van Oosterhout
Дата:
Сообщение: Re: SPI_execute (result of a select statement)
Следующее
От: Martijn van Oosterhout
Дата:
Сообщение: Re: Trigger (Transaction related)