Skip site navigation (1) Skip section navigation (2)

Proposal: new pg_dump options --copy-delimiter and --copy-null

From: David Fetter <david(at)fetter(dot)org>
To: PG Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Proposal: new pg_dump options --copy-delimiter and --copy-null
Date: 2006-01-27 01:03:25
Message-ID: 20060127010325.GC11803@fetter.org (view raw or flat)
Thread:
Lists: 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(at)fetter(dot)org http://fetter.org/
phone: +1 415 235 3778

Remember to vote!

Responses

pgsql-hackers by date

Next:From: Tom LaneDate: 2006-01-27 03:17:05
Subject: Re: Proposal: new pg_dump options --copy-delimiter and --copy-null
Previous:From: Philip WarnerDate: 2006-01-27 00:09:15
Subject: Re: Suggestions for post-mortem...

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group