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