Andrew Dunstan wrote: > Bruce Momjian wrote: > > >Andrew Dunstan wrote: > > > > > >>In fact, in the patch I sent in, no quoted string is marked as null when > >>being read (so even if you use \N as the null marker, "\N" will be that > >>literal and not a null marker). And the null marker, whatever it is, > >>should be made quote safe by us throwing an error if it contains the > >>quote marker, just as we now make sure that the null marker is > >>delimiter-safe. > >> > >> > > > >What value does an int column get if the input file has ',,'. Don't > >tell me zero? :-) Error? > > > > > > If the null marker is not an empty string, it gets an error, of course - > if it is it gets a null: > > [EMAIL PROTECTED] pginst]$ echo ',,' | bin/psql -c "create temp table > foo (a int, b text, c text); copy foo from stdin delimiter ',\"' null > '\\\\N';" > ERROR: invalid input syntax for integer: "" > CONTEXT: COPY foo, line 1, column a: "" > [EMAIL PROTECTED] pginst]$ echo ',,' | bin/psql -c "create temp table > foo (a int, b text, c text); copy foo from stdin delimiter ',\"' ;" > [EMAIL PROTECTED] pginst]$ > > > I hope that is expected behaviour - it's what *I* expect, at least. >
Yea, sorry, I misread your "no quoted string is marked as null" as not handling ,, as null. > Attached patch has these additions to previously posted patch: > . quote character may not appear in NULL marker > . any non-null value that matches the NULL marker is forced to be quoted > when written. OK, let me work on this now and repost. -- Bruce Momjian | http://candle.pha.pa.us [EMAIL PROTECTED] | (610) 359-1001 + If your life is a hard drive, | 13 Roberts Road + Christ can be your backup. | Newtown Square, Pennsylvania 19073 ---------------------------(end of broadcast)--------------------------- TIP 2: you can get off all lists at once with the unregister command (send "unregister YourEmailAddressHere" to [EMAIL PROTECTED])