pg.ddx.io pgsql-interfaces@postgresql.org mailing list archive
help / color / mirror / Atom feedchange tuple before insert
3+ messages / 2 participants
[nested] [flat]
* change tuple before insert
@ 2006-08-02 11:03 vivek@staff.ownmail.com
2006-08-02 12:55 ` Re: change tuple before insert Tom Lane <tgl@sss.pgh.pa.us>
0 siblings, 1 reply; 3+ messages in thread
From: vivek@staff.ownmail.com @ 2006-08-02 11:03 UTC (permalink / raw)
To: pgsql-interfaces
How do i change the contents of a tuple for a row level trigger? do i have to return tg_trigtuple or tg_newtuple? The doc is confusing. it says a tg_newtuple can only be used in case of an update>
With warm regards.
Vivek J. Joshi.
vivek@staff.ownmail.com
Trikon electronics Pvt. Ltd.
All science is either physics or stamp collecting.
-- Ernest Rutherford
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: change tuple before insert
2006-08-02 11:03 change tuple before insert vivek@staff.ownmail.com
@ 2006-08-02 12:55 ` Tom Lane <tgl@sss.pgh.pa.us>
0 siblings, 0 replies; 3+ messages in thread
From: Tom Lane @ 2006-08-02 12:55 UTC (permalink / raw)
To: vivek@staff.ownmail.com; +Cc: pgsql-interfaces
<vivek@staff.ownmail.com> writes:
> How do i change the contents of a tuple for a row level trigger? do i have to return tg_trigtuple or tg_newtuple? The doc is confusing. it says a tg_newtuple can only be used in case of an update>
You should not scribble on either of those. Make a fresh tuple and
return that.
regards, tom lane
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: change tuple before insert
@ 2006-08-02 13:43 vivek@staff.ownmail.com
0 siblings, 0 replies; 3+ messages in thread
From: vivek@staff.ownmail.com @ 2006-08-02 13:43 UTC (permalink / raw)
To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: pgsql-interfaces
Thanks Tom,
I am planning to use the function:-
HeapTuple SPI_copytuple(HeapTuple row) first and then modify the returned tuple using:-
HeapTuple SPI_modifytuple(Relation rel, HeapTuple row, ncols, colnum, Datum * values, const char * nulls)
But I am stuck here. How do I convert a string into Datum type required for parameter 4 of SPI_modifytuple. I think the datum type is some binary value and I want to insert a string in that coloumn.
With warm regards.
Vivek J. Joshi.
vivek@staff.ownmail.com
Trikon electronics Pvt. Ltd.
All science is either physics or stamp collecting.
-- Ernest Rutherford
Tom Lane wrote:
> ><vivek@staff.ownmail.com> writes:
>> How do i change the contents of a tuple for a row level trigger? do i have to
return tg_trigtuple or tg_newtuple? The doc is confusing. it says a tg_newtuple
can only be used in case of an update>
>
>You should not scribble on either of those. Make a fresh tuple and
>return that.
>
> regards, tom lane
^ permalink raw reply [nested|flat] 3+ messages in thread
end of thread, other threads:[~2006-08-02 13:43 UTC | newest]
Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2006-08-02 11:03 change tuple before insert vivek@staff.ownmail.com
2006-08-02 12:55 ` Tom Lane <tgl@sss.pgh.pa.us>
2006-08-02 13:43 Re: change tuple before insert vivek@staff.ownmail.com
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox