pg.ddx.io  pgsql-interfaces@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Brijesh Shrivastav <Bshrivastav@esri.com>
Cc: pgsql-interfaces@postgresql.org
Subject: Re: Inserting data a UDT in binary format using LIBPQ
Date: Tue, 09 Jan 2007 16:17:20 -0500
Message-ID: <10467.1168377440@sss.pgh.pa.us> (raw)
In-Reply-To: <5774D66D5EC83645A99B3A905527BB71B2A922@zipwire.esri.com>
References: <5774D66D5EC83645A99B3A905527BB71B2A922@zipwire.esri.com>

"Brijesh Shrivastav" <Bshrivastav@esri.com> 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



view thread (3+ messages)  latest in thread

Message-ID: <10467.1168377440@sss.pgh.pa.us>
Permalink:  ../10467.1168377440@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/10467.1168377440@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-interfaces@postgresql.org
  Cc: tgl@sss.pgh.pa.us, Bshrivastav@esri.com
  Subject: Re: Inserting data a UDT in binary format using LIBPQ
  In-Reply-To: <10467.1168377440@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

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