From: | "Damjan Pipan" <damjan(dot)pipan(at)xlab(dot)si> |
---|---|
To: | "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: modifying new tuple on insert in c trigger |
Date: | 2002-11-27 08:38:45 |
Message-ID: | 001d01c295f0$c8b5c300$6700010a@valhala |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Thanks for the help, but I have solved the problem already.
The problem was that I tried to do
char *a = DatumGetCString(SPI_getbinval(...)) for a varchar field
and it did not work. I'm using now SPI_getvalue
Damjan
----- Original Message -----
From: "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Damjan Pipan" <damjan(dot)pipan(at)xlab(dot)si>
Cc: <pgsql-general(at)postgresql(dot)org>
Sent: Wednesday, November 27, 2002 4:57 AM
Subject: Re: [GENERAL] modifying new tuple on insert in c trigger
> "Damjan Pipan" <damjan(dot)pipan(at)xlab(dot)si> writes:
> > 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.
>
> Before groveling through the C code ... did you declare the trigger
> as BEFORE or AFTER? Only BEFORE triggers get to change the inserted
> tuple.
>
> Also, I think the "r" array needs to contain 'r' not ' ' at the
> positions where you want to replace columns.
>
> regards, tom lane
>
>
From | Date | Subject | |
---|---|---|---|
Next Message | Erwan DUROSELLE | 2002-11-27 09:28:29 | Rp. : Mailing list question |
Previous Message | Jean-Christian Imbeault | 2002-11-27 06:35:19 | Mailing list question |