Received: from localhost (maia-4.hub.org [200.46.204.183]) by postgresql.org (Postfix) with ESMTP id A3B6A9FB1CE for ; Tue, 9 Jan 2007 17:17:30 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-new, port 10024) with ESMTP id 40727-08 for ; Tue, 9 Jan 2007 17:17:25 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey-1.7.4 Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by postgresql.org (Postfix) with ESMTP id D6F469FA4B9 for ; Tue, 9 Jan 2007 17:17:23 -0400 (AST) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.13.6/8.13.6) with ESMTP id l09LHK3j010468; Tue, 9 Jan 2007 16:17:20 -0500 (EST) To: "Brijesh Shrivastav" cc: pgsql-interfaces@postgresql.org Subject: Re: Inserting data a UDT in binary format using LIBPQ In-reply-to: <5774D66D5EC83645A99B3A905527BB71B2A922@zipwire.esri.com> References: <5774D66D5EC83645A99B3A905527BB71B2A922@zipwire.esri.com> Comments: In-reply-to "Brijesh Shrivastav" message dated "Tue, 09 Jan 2007 09:30:22 -0800" Date: Tue, 09 Jan 2007 16:17:20 -0500 Message-ID: <10467.1168377440@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200701/11 X-Sequence-Number: 6389 "Brijesh Shrivastav" writes: > Datum func_Recv(PG_FUNCTION_ARGS) > { > FUNC_BINARY_FORMAT *input > = (FUNC_BINARY_FORMAT *)PG_DETOAST_DATUM(PG_GETARG_DATUM(0)); Why would you expect that the input to a receive function would be already in the datatype's internal format? I'm too lazy to go check the code right now, but my recollection is that what you get is a reference to a StringInfo holding the data message received from the client. You should probably not touch the StringInfo directly if you can avoid it, but use the convenience functions that are provided for receive functions to use. Look at the code for existing receive functions for datatypes similar to yours. regards, tom lane