From: Paul Jungwirth <pj@illuminatedcomputing.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: pgsql-general@lists.postgresql.org
Subject: Re: When does Postgres use binary I/O?
Date: Wed, 18 Sep 2019 12:28:06 -0700
Message-ID: <a98a96b7-ccb6-1c9f-43ec-e477a9e642be@illuminatedcomputing.com> (raw)
In-Reply-To: <24378.1568816806@sss.pgh.pa.us>
References: <CA+renyXcVryG-x+BKoDnkFpf2PctPbB4Rv6LDHqhvQnkHWL3tw@mail.gmail.com>
<24378.1568816806@sss.pgh.pa.us>
On 9/18/19 7:26 AM, Tom Lane wrote:
> The core regression tests don't systematically exercise binary I/O,
> and they certainly wouldn't magically cover a new type they didn't
> use to. You'd need to add test case(s).
Thanks! I thought psql might use binary IO internally when available, or
at least pg_dump with its custom format, but it looks like neither of
those are true---and now that I think about it I suppose the code in adt
isn't something they would be able to use, so it makes sense.
So I guess my choices are to use COPY WITH (FORMAT BINARY) or write
something that calls PQexecParams. Does anything else use binary I/O?
> 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. :-)
But even if that's not an automated test at least it gives me an easy
way to manually exercise my own multirange_{send,recv} functions.
Thanks!
--
Paul ~{:-)
pj@illuminatedcomputing.com
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: pj@illuminatedcomputing.com, tgl@sss.pgh.pa.us
Subject: Re: When does Postgres use binary I/O?
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>
* 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