Re: COPY formatting

Поиск
Список
Период
Сортировка
От Andrew Dunstan
Тема Re: COPY formatting
Дата
Msg-id 4058778A.5030708@dunslane.net
обсуждение исходный текст
Ответ на COPY formatting  (Karel Zak <zakkr@zf.jcu.cz>)
Список pgsql-hackers
Karel Zak wrote:

> Hi,
>
> in TODO is item: "* Allow dump/load of CSV format". I don't think
> it's clean idea. Why CSV and why not something other? :-) 
>
> A why not allow to users full control of the format by they own
> function. It means something like:
> 
> COPY tablename [ ( column [, ...] ) ]
>     TO { 'filename' | STDOUT }
>     [ [ WITH ] 
>          [ BINARY ]
>          [ OIDS ]
>          [ DELIMITER [ AS ] 'delimiter' ]
>          [ NULL [ AS ] 'null string' ]
>          [ FORMAT funcname ] ]
>           ^^^^^^^^^^^^^^^^
>                                                 
> The formatting function API can be pretty simple:
>
> text *my_copy_format(text *attrdata, int direction, 
>             int nattrs, int attr, oid attrtype, oid relation)
>
> -- it's pseudocode of course, it should be use standard fmgr
> interface.
> 
> It's probably interesting for non-binary COPY version.
> 
>  
>

Interesting ... The alternative might be an external program to munge 
CSVs and whatever other format people want to support and then call the 
exisiting COPY- either in bin or contrib. I have seen lots of people 
wanting to import CSVs, and that's even before we get a Windows port.

cheers

andrew


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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: COPY formatting
Следующее
От: Fernando Nasser
Дата:
Сообщение: Re: COPY formatting