Re: Types info on binary copy

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Daniele Varrazzo <daniele(dot)varrazzo(at)gmail(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Types info on binary copy
Date: 2021-01-05 18:53:29
Message-ID: 3387244.1609872809@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Daniele Varrazzo <daniele(dot)varrazzo(at)gmail(dot)com> writes:
> Naively, it would seem that once a "COPY ... FROM STDIN" is executed
> successfully, the server has a pretty good idea of what data types it
> is expecting. I'm wondering: is it absurd to ask for this info to be
> returned as RowDescription and to be exposed by the libpq PQftype()?

It'd be a protocol break, unfortunately, since no such message is
sent as part of the COPY protocol. The 'G' (begin copy in) message
only carries the number of columns and column format codes. I agree
that for an intelligent source agent it might be useful to know the
column datatypes, but that idea didn't occur to us at the time :-(.

Now having said that, I believe we do have the ability now for a
client to request protocol extension(s) at connection start. So
maybe you could make it work that way. Probably a RowDescription
message before "begin copy out" would be useful too.

regards, tom lane

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Joel Jacobson 2021-01-05 19:23:15 Re: set_config() documentation clarification
Previous Message Tom Lane 2021-01-05 18:24:11 Re: macOS SIP, next try