Types info on binary copy

Поиск
Список
Период
Сортировка
От Daniele Varrazzo
Тема Types info on binary copy
Дата
Msg-id CA+mi_8ama_9uM0CbO3q2xHpMuAcNH7-DQkkZKGHq=Xu95aJJmw@mail.gmail.com
обсуждение исходный текст
Ответы Re: Types info on binary copy  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
Hello,

The PGresult structure returned on COPY ... FROM provides a handful of
information (https://www.postgresql.org/docs/13/libpq-copy.html):
number of fields expected and whether they are binary or not.

However it doesn't provide the types expected. For binary copy the
exact type is important: playing with it, it seems that no cast
whatsoever is applied and the errors reported are relatively low
level. For instance, passing an int4 value to an int8 field causes a
"protocol_violation: insufficient data left in message"; the other way
around is greeted with "invalid_binary_representation: incorrect
binary data format".

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()?

Cheers

-- Daniele



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Andrew Dunstan
Дата:
Сообщение: Re: Context diffs
Следующее
От: Andrew Dunstan
Дата:
Сообщение: Re: Cirrus CI (Windows help wanted)