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

Re: allow CSV quote in NULL

From: Stephen Frost <sfrost(at)snowman(dot)net>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-patches(at)postgresql(dot)org
Subject: Re: allow CSV quote in NULL
Date: 2007-07-27 05:03:27
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-hackerspgsql-patches
* Tom Lane (tgl(at)sss(dot)pgh(dot)pa(dot)us) wrote:
> Stephen Frost <sfrost(at)snowman(dot)net> writes:
> >   Please find attached a minor patch to remove the constraints that a
> >   user can't include the delimiter or quote characters in a 'NULL AS'
> >   string when importing CSV files.
> This can't really be sane can it?

hm?  It's a problem I've run into a number of times and I finally got
fed up with it enough to create a patch for it.  It solves my problem
and I don't believe breaks or adversely affects anything else.  It also
has to be explicitly asked for by the user, and when the user asks for
it, what's done is intuitively what would be expected.

I don't see the logic in forbidding the user from being able to do
this...  My specific case involved an integer field which was quoted in
the CSV file (which isn't generally a problem, it's only an issue if it
ends up being a an empty string).  I could easily see it being used for
text fields as well though, if, for example, they want empty strings,
even when quoted, to import as NULLs.  Of course, the default remains
that it'd be imported as an empty string, having it be a NULL has to be
explicitly requested.



In response to


pgsql-hackers by date

Next:From: Oleg BartunovDate: 2007-07-27 06:10:42
Subject: Re: Updated tsearch documentation
Previous:From: Stephen FrostDate: 2007-07-27 04:53:11
Subject: Re: Building CVS problem?

pgsql-patches by date

Next:From: Gregory StarkDate: 2007-07-27 09:22:42
Subject: Re: allow CSV quote in NULL
Previous:From: Tom LaneDate: 2007-07-27 04:51:56
Subject: Re: allow CSV quote in NULL

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