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: Sun, 22 Sep 2019 14:53:44 -0400
Message-ID: <21027.1569178424@sss.pgh.pa.us> (raw)
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>
I wrote:
> 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.
> 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.
I thought of an easier-to-maintain approach to that part than having
a reference file. Binary send functions are invokable from SQL,
so we could just imagine adding test cases along the lines of
regression=# select int8send(42);
int8send
--------------------
\x000000000000002a
(1 row)
for each data type. This would be enough to detect endianness issues,
garbage in padding bytes, etc.
The receive functions are not so easy to call, so we still need a
round-trip test, but you could imagine a TAP test framework for that.
Or, perhaps, the thing to do would be to provide a generic test function
that takes a value, runs it through the type's send and then receive
functions, and returns the result (or just complains if it gets different
bits out ...)
regards, tom lane
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: <21027.1569178424@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> <21027.1569178424@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