Proposal: new pg_dump options --copy-delimiter and --copy-null - Mailing list pgsql-hackers

From David Fetter
Subject Proposal: new pg_dump options --copy-delimiter and --copy-null
Date
Msg-id 20060127010325.GC11803@fetter.org
Whole thread Raw
Responses Re: Proposal: new pg_dump options --copy-delimiter and --copy-null
List pgsql-hackers
Folks,

This came up at work...

I have seed database scripts quasi-generated from pg_dump which
include COPY statements, but the data is hard to edit (especially cut
& paste operations) when the COPY delimiter is some non-visible
character like \t.  So I thought it would be handy to be able to
control the DELIMITER and NULL options in COPY statements that pg_dump
uses.

Although it would be nice to make CSV and its dependencies one of the
options, I'm not sure how pg_dump would handle the end-of-line
problem, so I've skipped that part in the patch I've put together.
The other option, FORCE QUOTE, doesn't make sense to me as a pg_dump
option, but I'm not the arbiter of these things.

With the patch, pg_dump would work exactly as usual without options,
but it now has two extra options: --copy-delimiter and --copy-null.

If set, these will be incorporated in COPY commands as appropriate.
--copy-delimiter accepts any single byte other than '\r' or '\n'.
--copy-null accepts any input.  The patched pg_dump ignores --copy-*
options in cases where COPY wouldn't happen anyway.

What do you folks think?

Cheers,
D
-- 
David Fetter david@fetter.org http://fetter.org/
phone: +1 415 235 3778

Remember to vote!


pgsql-hackers by date:

Previous
From: Philip Warner
Date:
Subject: Re: Suggestions for post-mortem...
Next
From: Tom Lane
Date:
Subject: Re: Proposal: new pg_dump options --copy-delimiter and --copy-null