Re: COPY formatting

From: Hans-Jürgen Schönig <postgres(at)cybertec(dot)at>
To: Karel Zak <zakkr(at)zf(dot)jcu(dot)cz>
Cc: pgsql-hackers <pgsql-hackers(at)postgreSQL(dot)org>
Subject: Re: COPY formatting
Date: 2004-03-17 15:02:35
Message-ID: 4058688B.6030804@cybertec.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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.
>
> 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.

Regards,

Hans

--
Cybertec Geschwinde u Schoenig
Schoengrabern 134, A-2020 Hollabrunn, Austria
Tel: +43/2952/30706 or +43/664/233 90 75
www.cybertec.at, www.postgresql.at, kernel.cybertec.at

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Fernando Nasser 2004-03-17 15:11:48 Re: COPY formatting
Previous Message Karel Zak 2004-03-17 14:38:13 COPY formatting