Re: Plan for CSV handling of quotes, NULL - Mailing list pgsql-patches

From Bruce Momjian
Subject Re: Plan for CSV handling of quotes, NULL
Date
Msg-id 200404150403.i3F43ko07299@candle.pha.pa.us
Whole thread Raw
In response to Re: Plan for CSV handling of quotes, NULL  (Bruce Momjian <pgman@candle.pha.pa.us>)
List pgsql-patches
Bruce Momjian wrote:
> Bruce Momjian wrote:
> > I talked to Andrew on IRC and we went over the open CSV issues.
> >
> > We talked about how we could do quoting for zipcode in TEXT fields and
> > not quote true numeric values without hardcoding datatypes into the
> > system.  The most tricky case was NUMERIC vs. TEXT with zipcodes.
> > NUMERIC and TEXT have almost identical pg_type entries, so there is
> > nothing there to help us.
> >
> > I found parse_coerce.c::TypeCategory(), which contains information about
> > which data type oids are in which grouping, e.g. DATETIME, STRING,
> > NUMERIC, etc.  It seems that function, if called with
> > pg_type.typbasetype could help determine if quotes should be used.  My
> > idea is to skip quotes for NUMERIC and DATETIME types, and quote
> > everything else.  This means that user-defined types will always be
> > output with quotes, which is probably OK.
> >
> > So, for open CSV items we have:
> >
> >     o  add oid dump/reload
> >     o  handle loading of comma-comma into NOT NULL collumns
> >     o  handle quoting of TEXT type with zipcodes, etc.
>
> Oh, one more item.  CSV needs a way to output date values in Datestyle
> format, for use by spreadsheets that understand mm/dd/yy dates, but not
> ISO dates.  This will not be on by default.

Ah, I see COPY already honors DateStyle on output.  I will mention that
in the COPY docs as a tip for CSV.

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

pgsql-patches by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: Plan for CSV handling of quotes, NULL
Next
From: Tom Lane
Date:
Subject: Re: Plan for CSV handling of quotes, NULL