Re: Types info on binary copy - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Types info on binary copy
Date
Msg-id 3387244.1609872809@sss.pgh.pa.us
Whole thread Raw
In response to Types info on binary copy  (Daniele Varrazzo <daniele.varrazzo@gmail.com>)
List pgsql-hackers
Daniele Varrazzo <daniele.varrazzo@gmail.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



pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: macOS SIP, next try
Next
From: "Joel Jacobson"
Date:
Subject: Re: set_config() documentation clarification