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

From Tom Lane
Subject Re: Plan for CSV handling of quotes, NULL
Date
Msg-id 12202.1082005582@sss.pgh.pa.us
Whole thread Raw
In response to Re: Plan for CSV handling of quotes, NULL  (Bruce Momjian <pgman@candle.pha.pa.us>)
Responses Re: Plan for CSV handling of quotes, NULL
List pgsql-patches
Bruce Momjian <pgman@candle.pha.pa.us> writes:
> Particularly, how do we identify a numeric and dates?

We don't, and I'm not convinced that we should.  The entire concept is
suspect in a type-agnostic system.  In particular, I've really got a
problem with the fact that TypeCategory uses a fixed, nonexpansible
set of categories.

Even if you try to push ahead with using TypeCategory, I'd lay a side
bet that it doesn't work.  Will those spreadsheets that make this
nonstandard assumption about quotes having semantic significance be able
to cope with all the possible output formats from timestamptz, for
instance?  How about timetz, which is in the same category?

> The only other thing we could do would be to add something to pg_type
> that says whether it needs quotes.  Seems like overkill.

Seems like wrong.  The real problem here is that "whether it needs
quotes" depends on the program you are intending to export to, the
semantic behavior you want, and likely also the phase of the moon.
I don't think we can hope to invent a COPY behavior rule that
automagically gets this right.  What's needed is a tool that can output
a user-customizable data format, and that seems to me to be outside
COPY's charter.

            regards, tom lane

pgsql-patches by date:

Previous
From: "Andrew Dunstan"
Date:
Subject: Re: Plan for CSV handling of quotes, NULL
Next
From: Bruce Momjian
Date:
Subject: Re: Plan for CSV handling of quotes, NULL