Create oid inside triggers in C
Create oid inside triggers in C
От:
juanmime@ono.com
Дата:
Hello, I'm developping a C function, that will be executed in triggers (similar a lo_manage, see contrib). This function will create an oid for one of the columns. Think in a table with two oid columns: create table example (img oid, thumb oid); img field contains an image and thumb, the thumbnail that will be create automatically after insert or update events (by this function). I think the steps could be: 1.- Read the value from the source field (img). I think it's resolved. 2.- Create a thumbnail image. I think it's resolved. 3.- Create an Oid for the new image, and update the thumb field. I think I should use lo_create, .... functions and SPI_modifytuple. (correct me if I wrong) I see the c interface, of the lo_creat: Oid lo_creat(PGconn *conn, int mode) And it needs a PGconn pointer to the pg connection. Well, is there an default connection pointer for triggers or something like this ? Thanks a lot.