X-Original-To: pgsql-interfaces-postgresql.org@postgresql.org Received: from localhost (mx1.hub.org [200.46.208.251]) by postgresql.org (Postfix) with ESMTP id 0FCFA9FB26D for ; Wed, 2 Aug 2006 10:43:58 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) with ESMTP id 54355-03 for ; Wed, 2 Aug 2006 10:43:54 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from svr4.postgresql.org (svr4.postgresql.org [66.98.251.159]) by postgresql.org (Postfix) with ESMTP id BA5349FB256 for ; Wed, 2 Aug 2006 10:43:54 -0300 (ADT) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.3 Received: from mail009.ownmail.com (unknown [203.199.110.93]) by svr4.postgresql.org (Postfix) with ESMTP id 6456B5AFB33 for ; Wed, 2 Aug 2006 13:43:51 +0000 (GMT) Received: (from domains@localhost) by mail009.ownmail.com (8.12.11/8.12.10) id k72DhZ0L006767; Wed, 2 Aug 2006 19:13:35 +0530 Date: Wed, 2 Aug 2006 19:13:35 +0530 Message-Id: <200608021343.k72DhZ0L006767@mail009.ownmail.com> X-Originating-IP: 203.199.110.93 Reply-To: From: To: Tom Lane Cc: pgsql-interfaces@postgresql.org Subject: Re: change tuple before insert MIME-Version: 1.0 X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=1.666 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO, NO_REAL_NAME X-Spam-Level: * Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Archive-Number: 200608/8 X-Sequence-Number: 6222 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: > > 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