Re: modifying new tuple on insert in c trigger - Mailing list pgsql-general

From Damjan Pipan
Subject Re: modifying new tuple on insert in c trigger
Date
Msg-id 004601c29205$1db6db90$6700a8c0@valhala
Whole thread Raw
In response to modifying new tuple on insert in c trigger  ("Damjan Pipan" <damjan.pipan@siol.net>)
List pgsql-general
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
>


pgsql-general by date:

Previous
From: Tino Wildenhain
Date:
Subject: Re: Changing the type of a column in an already populated
Next
From: Richard Huxton
Date:
Subject: Re: Migrating data from MSAccess