Re: Inserting data a UDT in binary format using LIBPQ

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Brijesh Shrivastav" <Bshrivastav(at)esri(dot)com>
Cc: pgsql-interfaces(at)postgresql(dot)org
Subject: Re: Inserting data a UDT in binary format using LIBPQ
Date: 2007-01-09 21:17:20
Message-ID: 10467.1168377440@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-interfaces

"Brijesh Shrivastav" <Bshrivastav(at)esri(dot)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

In response to

Browse pgsql-interfaces by date

  From Date Subject
Next Message Brijesh Shrivastav 2007-01-09 21:51:01 Re: Inserting data a UDT in binary format using LIBPQ
Previous Message Brijesh Shrivastav 2007-01-09 17:30:22 Inserting data a UDT in binary format using LIBPQ