Daniele Varrazzo <daniele.varra...@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