Re: Plan for CSV handling of quotes, NULL

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: PostgreSQL-patches <pgsql-patches(at)postgresql(dot)org>
Cc: Richard Huxton <richardh(at)archonet(dot)com>, Andrew Dunstan <andrew(at)dunslane(dot)net>
Subject: Re: Plan for CSV handling of quotes, NULL
Date: 2004-04-16 04:21:12
Message-ID: 200404160421.i3G4LC905540@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-patches

Bruce Momjian wrote:
> Richard Huxton wrote:
> > On Thursday 15 April 2004 15:58, Bruce Momjian wrote:
> > >
> > > OK, so we need a list of columns for output with quotes, and a list of
> > > columns where NULL should be changed to zero-length strings.
> > >
> > > How about if we use FORCE to force quotes on output, and CONVERT to
> > > convert null to zero-length strings on input?
> >
> > How about FORCEQUOTES and NULLTOBLANK which tells you what they will do?
>
> Yea, I am trying to decide keywords now. I have the code compiling and
> working and will post shortly.
>
> I used FORCE for the force-quotes capability. Talking to Andrew, he
> suggests instead of force to blanks, just ignore the NULL specification
> (usually blank for CSV), so I though of using LITERAL, but that seems
> wrong. I am looking for suggestions on working. Ideally it would be
> something that suggests the NULL specification test is skiped for that
> column.

Here is a new version of the patch. The call to TypeCategory() is gone,
and in its place is a way to force quotes on output, using FORCE. And,
instead of warning about a nullstring going into a NOT NULL column,
there is a new LITERAL capability that does not compare the column with
the null string and loads the value in literally.

The patch still needs more testing, but I have reviewed the patch and it
looks good to me.

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073

Attachment Content-Type Size
unknown_filename text/plain 43.6 KB

In response to

Responses

Browse pgsql-patches by date

  From Date Subject
Next Message Bruce Momjian 2004-04-16 12:58:20 Fix for SIGTERM
Previous Message Bruce Momjian 2004-04-16 02:34:58 Re: Plan for CSV handling of quotes, NULL