Create oid inside triggers in C

From: juanmime(at)ono(dot)com
To: pgadmin-support(at)postgresql(dot)org
Subject: Create oid inside triggers in C
Date: 2005-04-18 15:31:55
Message-ID: 424AACA10000D73B@resmta01.ono.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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.

Browse pgadmin-support by date

  From Date Subject
Next Message Gabriel Papadopol 2005-04-20 11:28:19 BUG: specifying point data type
Previous Message James Prichard 2005-04-18 15:17:06 Re: Query regarding Bulk Import