pg.ddx.io  pgsql-interfaces@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Joris van Zwieten <vanzwieten@stcorp.nl>
To: Bruce Momjian <bruce@momjian.us>
Cc: vanzwieten@stcorp.nl, "Jeroen T. Vermeulen" <jtv@xs4all.nl>
Cc: pgsql-interfaces@postgresql.org
Subject: Re: Array handling in libpq
Date: Wed, 17 Jan 2007 20:39:09 +0100 (CET)
Message-ID: <55030.192.87.1.229.1169062749.squirrel@control.prolocation.net> (raw)
In-Reply-To: <200701171546.l0HFkHV22381@momjian.us>
References: <200701171546.l0HFkHV22381@momjian.us>

Well... It wouldn't have to be ASCII, right? As long as the way it is
communicated between server and client is standardized. On the server
side, each type has a _send() and _recv() method that performs a
conversion from the internal representation on the server side to a
standard representation that is used for communication with the client, if
I'm not mistaken.

For instance, the int4 type is send in network byte order by the server,
even if this is not the native byte order of the architecture on which the
server is compiled/ran.

If the client, i.e. libpq, would just convert back from this standard
format to the byte order used on the host architecture everything should
be nicely transparent. But from the libpq examples it seems libpq does not
do this. Come to think of it, wouldn't it be possible to re-use the
implementation of the _send/_recv methods from the server to perform the
necessary conversion on the client side?

I suppose that something similar should be possible with floating point
types, although it might be more involved.
Bye,

Joris

On Wed, January 17, 2007 4:46 pm, Bruce Momjian wrote:
> Joris van Zwieten wrote:
>
>> Hi Bruce, Jeroen,
>>
>>
>> Thanks for your replies. This is good to know, although one worry
>> remains and that is loss of precision in the conversion of double to
>> string. But this could probably always be solved by using enough digits
>> in the conversion, right?
>
> Also, the client and server can be different architectures, so the only
> portable way to do the transfer is ASCII.
>
> --
> Bruce Momjian   bruce@momjian.us
> EnterpriseDB    http://www.enterprisedb.com
>
>
> + If your life is a hard drive, Christ can be your backup. +
>
>





view thread (8+ messages)

Message-ID: <55030.192.87.1.229.1169062749.squirrel@control.prolocation.net>
Permalink:  ../55030.192.87.1.229.1169062749.squirrel@control.prolocation.net/
Also on:    postgresql.org/message-id/55030.192.87.1.229.1169062749.squirrel@control.prolocation.net

 · 

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: vanzwieten@stcorp.nl, bruce@momjian.us, jtv@xs4all.nl
  Subject: Re: Array handling in libpq
  In-Reply-To: <55030.192.87.1.229.1169062749.squirrel@control.prolocation.net>

* 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