Re: Binary Cursors, and the COPY command

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql(at)mohawksoft(dot)com
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Binary Cursors, and the COPY command
Date: 2004-07-26 18:11:38
Message-ID: 6334.1090865498@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-jdbc

pgsql(at)mohawksoft(dot)com writes:
> Lastly, the vast majority of machines in use today are intel. Meaning that
> they are small endian. Except in a very rare circumstance, two machines
> that would normally be able to communicate in native byte order, will
> ALWAYS have to convert data.

Quite honestly, that is exactly one of the reasons for using network
order. If we standardized on little-endian then 90% of programmers
would ignore the need to do anything about byte ordering issues, and
their code would be unportable to big-endian machines.

Putting a byte order flag into the header doesn't improve matters;
it just forces everybody to deal with *both* orders, which is not
simpler. (Except for those who would like not to be bothered with
portability, which is a position I have zero sympathy for.)

If you don't want to deal with this, don't use binary data. It's as
simple as that.

BTW, for your stated use-case of combining binary output from separate
databases, I should think you'd be happy about having a not-so-machine-
dependent data format. It would still work if the databases were
running on servers of different endianness.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Brian Hirt 2004-07-26 18:26:16 WARNING: buffer refcount leak
Previous Message Marc G. Fournier 2004-07-26 18:10:13 Re: CVS web interface error

Browse pgsql-jdbc by date

  From Date Subject
Next Message Ian Pilcher 2004-07-26 18:23:46 Re: Problem w/ IDENT authentication
Previous Message Yi LIN 2004-07-26 17:49:34 Re: conflict txns in serialization isolation