Create oid inside triggers in C - Mailing list pgadmin-support

From juanmime@ono.com
Subject Create oid inside triggers in C
Date
Msg-id 424AACA10000D73B@resmta01.ono.com
Whole thread Raw
List pgadmin-support
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.




pgadmin-support by date:

Previous
From: "James Prichard"
Date:
Subject: Re: Query regarding Bulk Import
Next
From: "Gabriel Papadopol"
Date:
Subject: BUG: specifying point data type