Re: raw output from copy

Поиск
Список
Период
Сортировка
От Dickson S. Guedes
Тема Re: raw output from copy
Дата
Msg-id CAHHcreokHjpNLGdD2tAhpuZwv7ftFs9rZPeEjN583UwQZ+CjjA@mail.gmail.com
обсуждение исходный текст
Ответ на Re: raw output from copy  (Pavel Stehule <pavel.stehule@gmail.com>)
Ответы Re: raw output from copy  (Pavel Stehule <pavel.stehule@gmail.com>)
Список pgsql-hackers
2015-07-07 3:32 GMT-03:00 Pavel Stehule <pavel.stehule@gmail.com>:
>
> Hi
>
> previous patch was broken, and buggy
>
> Here is new version with fixed upload and more tests
>
> The interesting is so I should not to modify interface or client - so it should to work with any current driver with
protocolsupport >= 3.
 

Hi Pavel,

Here are some thoughts:

1) from docs: "only row data in network byte order are exported or imported."

Should it be "only raw data"?

2) from docs "Because this format doesn't support any delimiter, only
one value  can be exported or imported. NULL values are not allowed."

That "only one value can be exported or imported" is a little sad for
someone with a table with more than one column that accepts bytea. The
implemented feature doesn't covers the use-case where a table 'image'
has columns: id integer, image bytea, thumbnail bytea, and I want to
import binary data in that. We could put here the cases where we have
NOT NULL columns. Since these are expected and the error messages
complain about that couldn't them be covered in docs more explicitly?

3) from code: "bool row_processed; /* true, when first row was processed */"

Maybe rename the variable to something like `first_row_processed` and
rip off the comment?

4) from code:

if (cstate->raw)   format = 2;
else if (cstate->binary)   format = 1;
else   format = 0;

Maybe create a constant for code readability?


If by one side this feature does not covers a more generalized case,
by other is a nice start, IMHO.

-- 
Dickson S. Guedes
mail/xmpp: guedes@guedesoft.net - skype: guediz
http://github.com/guedes - http://guedesoft.net
http://www.postgresql.org.br



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

Предыдущее
От: Josh Berkus
Дата:
Сообщение: Re: Autonomous Transaction is back
Следующее
От: Oleg Bartunov
Дата:
Сообщение: Re: Speakers Wanted for pgDay Cuba