Re: modifying new tuple on insert in c trigger

From: "Damjan Pipan" <damjan(dot)pipan(at)siol(dot)net>
To: "Doug McNaught" <doug(at)mcnaught(dot)org>
Cc: <pgsql-general(at)postgresql(dot)org>
Subject: Re: modifying new tuple on insert in c trigger
Date: 2002-11-22 08:56:32
Message-ID: 004601c29205$1db6db90$6700a8c0@valhala
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)mcnaught(dot)org>
To: "Damjan Pipan" <damjan(dot)pipan(at)siol(dot)net>
Cc: <pgsql-general(at)postgresql(dot)org>
Sent: Wednesday, November 20, 2002 2:45 PM
Subject: Re: [GENERAL] modifying new tuple on insert in c trigger

> "Damjan Pipan" <damjan(dot)pipan(at)siol(dot)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
>

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Tino Wildenhain 2002-11-22 08:57:05 Re: Changing the type of a column in an already populated
Previous Message Hans-Jürgen Schönig 2002-11-22 08:24:22 Using SHOW in PL/pgSQL