Re: Review: Patch FORCE_NULL option for copy COPY in CSV mode

From: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>
To: Bruce Momjian <bruce(at)momjian(dot)us>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Andrew Dunstan <andrew(at)dunslane(dot)net>, Ian Lawrence Barwick <barwick(at)gmail(dot)com>, Payal Singh <payal(at)omniti(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Review: Patch FORCE_NULL option for copy COPY in CSV mode
Date: 2014-04-22 21:53:54
Message-ID: CAB7nPqSZdpDV0-w_3qrTWLHdFHnLb7ZsJc3okbnb4818ji_VnA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, Apr 23, 2014 at 5:07 AM, Bruce Momjian <bruce(at)momjian(dot)us> wrote:

> On Fri, Mar 7, 2014 at 05:08:54PM +0900, Michael Paquier wrote:
> > On Thu, Mar 6, 2014 at 12:09 AM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> > > Andrew Dunstan <andrew(at)dunslane(dot)net> writes:
> > >> On 03/05/2014 09:11 AM, Michael Paquier wrote:
> > >>> After testing this feature, I noticed that FORCE_NULL and
> > >>> FORCE_NOT_NULL can both be specified with COPY on the same column.
> > >
> > >> Strictly they are not actually contradictory, since FORCE NULL relates
> > >> to quoted null strings and FORCE NOT NULL relates to unquoted null
> > >> strings. Arguably the docs are slightly loose on this point. Still,
> > >> applying both FORCE NULL and FORCE NOT NULL to the same column would
> be
> > >> rather perverse, since it would result in a quoted null string
> becoming
> > >> null and an unquoted null string becoming not null.
> > >
> > > Given the remarkable lack of standardization of "CSV" output, who's
> > > to say that there might not be data sources out there for which this
> > > is the desired behavior? It's weird, I agree, but I think throwing
> > > an error for the combination is not going to be helpful. It's not
> > > like somebody might accidentally write both on the same column.
> > >
> > > +1 for clarifying the docs, though, more or less in the words you
> > > used above.
> > Following that, I have hacked the patch attached to update the docs
> > with an additional regression test (actually replaces a test that was
> > the same as the one before in copy2).
> >
> > I am attaching as well a second patch for file_fdw, to allow the use
> > of force_null and force_not_null on the same column, to be consistent
> > with COPY.
> > Regards,
>
> Correction, this is the patch applied, not the earlier version.
>
Thanks for taking the time to look at that.
--
Michael

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2014-04-22 21:54:54 Re: Patch for CREATE RULE sgml -- Was in: [DOCS]
Previous Message Andres Freund 2014-04-22 21:51:58 Re: assertion failure 9.3.4