Search Postgresql Archives

Trigger (Transaction related)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux