pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Paul Jungwirth <pj@illuminatedcomputing.com>
Cc: pgsql-general@lists.postgresql.org
Subject: Re: When does Postgres use binary I/O?
Date: Wed, 18 Sep 2019 17:49:15 -0400
Message-ID: <12605.1568843355@sss.pgh.pa.us> (raw)
In-Reply-To: <a98a96b7-ccb6-1c9f-43ec-e477a9e642be@illuminatedcomputing.com>
References: <CA+renyXcVryG-x+BKoDnkFpf2PctPbB4Rv6LDHqhvQnkHWL3tw@mail.gmail.com>
	<24378.1568816806@sss.pgh.pa.us>
	<a98a96b7-ccb6-1c9f-43ec-e477a9e642be@illuminatedcomputing.com>

Paul Jungwirth <pj@illuminatedcomputing.com> writes:
> On 9/18/19 7:26 AM, Tom Lane wrote:
>> Likely it'd be good to have some more consistent approach to
>> testing that ... right now it's not even very obvious where
>> is a good place to add such tests.  I do see a small test in
>> src/test/regress/input/misc.source (COPY BINARY stud_emp),
>> but that solution doesn't scale easily because of its
>> dependence on absolute file pathnames.

> I'm not sure how hard this would be, but we could add a new schema to 
> the regression db and then do something like this:

> psql -d regression -c 'COPY public.t TO STDOUT WITH (FORMAT BINARY)' \
>    | psql -d regression -c 'COPY binaryio.t FROM STDIN WITH (FORMAT BINARY)'

> and then verify that `SELECT *` looks the same for the two tables. I can 
> think of several complications already though. :-)

Yeah, that's more or less what the existing test case does, but only
for a rather small set of types.

The major thing that this style of test misses, IMO, is that it
proves nothing at all about the stability of the binary representation.
In particular, it'd be almost trivially easy for someone to screw up
the expectation of endianness independence for the binary format.
(I live in fear that we will, or have already, shipped such a bug
with nobody noticing.)

To address that, I think we'd not only want to check the round-trip
behavior, but also compare the binary output to a "known good"
reference file.  If we messed up on endianness independence, the
bigendian members of the buildfarm would find it immediately.

			regards, tom lane





view thread (7+ messages)  latest in thread

Message-ID: <12605.1568843355@sss.pgh.pa.us>
Permalink:  ../12605.1568843355@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/12605.1568843355@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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: tgl@sss.pgh.pa.us, pj@illuminatedcomputing.com
  Subject: Re: When does Postgres use binary I/O?
  In-Reply-To: <12605.1568843355@sss.pgh.pa.us>
  References: <CA+renyXcVryG-x+BKoDnkFpf2PctPbB4Rv6LDHqhvQnkHWL3tw@mail.gmail.com> <24378.1568816806@sss.pgh.pa.us> <a98a96b7-ccb6-1c9f-43ec-e477a9e642be@illuminatedcomputing.com> <12605.1568843355@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