Re: [PATCHES] Plan for CSV handling of quotes, NULL

2004-04-16 Thread Andrew Dunstan
Bruce Momjian wrote: 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

Re: [PATCHES] Plan for CSV handling of quotes, NULL

2004-04-15 Thread Andrew Dunstan
Bruce Momjian said: Andrew Dunstan wrote: copy mytable to 'mydata.csv' csv force zipcode; seems OK to me. I'm all in favor of low-tecH solutions where appropriate. ;-) Could we have FORCE just force quotes on all values, rather than allowing a list of columns to be specified? Seems if

Re: [PATCHES] Plan for CSV handling of quotes, NULL

2004-04-15 Thread Bruce Momjian
Andrew Dunstan wrote: Bruce Momjian said: Andrew Dunstan wrote: copy mytable to 'mydata.csv' csv force zipcode; seems OK to me. I'm all in favor of low-tecH solutions where appropriate. ;-) Could we have FORCE just force quotes on all values, rather than allowing a list of

Re: [PATCHES] Plan for CSV handling of quotes, NULL

2004-04-15 Thread Andrew Dunstan
Bruce Momjian wrote: Andrew Dunstan wrote: Bruce Momjian said: Andrew Dunstan wrote: copy mytable to 'mydata.csv' csv force zipcode; seems OK to me. I'm all in favor of low-tecH solutions where appropriate. ;-) Could we have FORCE just force quotes on all values, rather

Re: [PATCHES] Plan for CSV handling of quotes, NULL

2004-04-15 Thread Bruce Momjian
Andrew Dunstan wrote: Bruce Momjian wrote: What about NULL input? Is my warning and promotion to zero-length string for NOT NULL columns OK? I know I originally floated this idea or one very like it, but I have become convinced it is not a good idea after all. The user might

Re: [PATCHES] Plan for CSV handling of quotes, NULL

2004-04-15 Thread Andrew Dunstan
Bruce Momjian wrote: Andrew Dunstan wrote: Bruce Momjian wrote: What about NULL input? Is my warning and promotion to zero-length string for NOT NULL columns OK? I know I originally floated this idea or one very like it, but I have become

Re: [PATCHES] Plan for CSV handling of quotes, NULL

2004-04-15 Thread Bruce Momjian
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

Re: [PATCHES] Plan for CSV handling of quotes, NULL

2004-04-14 Thread Bruce Momjian
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.

Re: [PATCHES] Plan for CSV handling of quotes, NULL

2004-04-14 Thread Bruce Momjian
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

Re: [PATCHES] Plan for CSV handling of quotes, NULL

2004-04-14 Thread Tom Lane
Bruce Momjian [EMAIL PROTECTED] writes: 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

Re: [PATCHES] Plan for CSV handling of quotes, NULL

2004-04-14 Thread Andrew Dunstan
Bruce Momjian said: So, for open CSV items we have: o add oid dump/reload There seems to be agreement on this at least. All you need to do is remove these lines - AFAICS the OID code should be able to be happily non-CSV- aware. /* * Don't allow OIDs in CSV mode

Re: [PATCHES] Plan for CSV handling of quotes, NULL

2004-04-14 Thread Tom Lane
Bruce Momjian [EMAIL PROTECTED] 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,

Re: [PATCHES] Plan for CSV handling of quotes, NULL

2004-04-14 Thread Bruce Momjian
Tom Lane wrote: Bruce Momjian [EMAIL PROTECTED] 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

Re: [PATCHES] Plan for CSV handling of quotes, NULL

2004-04-14 Thread Bruce Momjian
Andrew Dunstan wrote: Bruce Momjian said: So, for open CSV items we have: o add oid dump/reload There seems to be agreement on this at least. All you need to do is remove these lines - AFAICS the OID code should be able to be happily non-CSV- aware. /* * Don't

Re: [PATCHES] Plan for CSV handling of quotes, NULL

2004-04-14 Thread Andrew Dunstan
Bruce Momjian said: Tom Lane wrote: TypeCategory is a crock that should have been done away with long ago. We need to be working to eliminate it, not expand our dependency on it. Ah, so do we have any other way to identify the type of field we are using? Particularly, how do we identify a

Re: [PATCHES] Plan for CSV handling of quotes, NULL

2004-04-14 Thread Bruce Momjian
Tom Lane wrote: Bruce Momjian [EMAIL PROTECTED] writes: 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

Re: [PATCHES] Plan for CSV handling of quotes, NULL

2004-04-14 Thread Bruce Momjian
Andrew Dunstan wrote: Bruce Momjian said: Tom Lane wrote: TypeCategory is a crock that should have been done away with long ago. We need to be working to eliminate it, not expand our dependency on it. Ah, so do we have any other way to identify the type of field we are using?