Re: COPY formatting

Поиск
Список
Период
Сортировка
От Fernando Nasser
Тема Re: COPY formatting
Дата
Msg-id 40586AB4.7060401@redhat.com
обсуждение исходный текст
Ответ на Re: COPY formatting  (Hans-Jürgen Schönig <postgres@cybertec.at>)
Ответы Re: COPY formatting  (Karel Zak <zakkr@zf.jcu.cz>)
Список pgsql-hackers
Hans-Jürgen Schönig wrote:
> 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.
>>  
>>  Comments?
>>
>>     Karel
>>
> 
> 
> Karel,
> 
> This seems to be an excellent idea.
> People have already asked for many different formats.
> Usually I recommend them to use "psql -c "COPY ..." dbname | awk ...".
> Since Windows will be supported soon, it will be hard to pipe data to a 
> useful program (awk, sed, ...). Maybe this feature would help a lot in 
> this case.
> 

Could a CSV-generating function be provided with the distribution then?

Regards,
Fernando


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

Предыдущее
От: Hans-Jürgen Schönig
Дата:
Сообщение: Re: COPY formatting
Следующее
От: Tom Lane
Дата:
Сообщение: Re: COPY formatting