I have already found the error - the functions CStringGetDatum and SPI_getvalue
does not work as I have expected. Now I'm getting values in binary and assigning
them directly to new value.
BTW
How can you transform a value in char* to Datum or vice versa? I tried with
CStringGetDatum and DatumGetCString but it did not work.
Damjan
----- Original Message -----
From: "Doug McNaught" <doug@mcnaught.org>
To: "Damjan Pipan" <damjan.pipan@siol.net>
Cc: <pgsql-general@postgresql.org>
Sent: Wednesday, November 20, 2002 2:45 PM
Subject: Re: [GENERAL] modifying new tuple on insert in c trigger
> "Damjan Pipan" <damjan.pipan@siol.net> writes:
>
> > Hello!
> >
> > I'm trying to write a c trigger function which would change an
> > attribute of tuple being inserted. I have read this value
> > from some other table and now I have a problem, because
> > even if I change the tuple with SPI_modifytuple and return
> > modified tuple it does not show in db (it did not change the tuple)
> > but tuple is inserted.
>
> Is it a BEFORE or AFTER trigger? If it's modifying the inserted tuple
> it needs to be BEFORE.
>
> -Doug
>