Re: [PATCHES] [BUGS] BUG #2221: Bad delimiters allowed in COPY ...

2007-02-05 Thread Tom Lane
Bruce Momjian <[EMAIL PROTECTED]> writes: > FYI, Tom, old email from Feb 1, 2006, from your server: Wups. Sorry about that --- somehow I confused that with the current thread about copy delimiters. Should have looked harder at the date. regards, tom lane ---

Re: [PATCHES] [BUGS] BUG #2221: Bad delimiters allowed in COPY ...

2007-02-05 Thread Bruce Momjian
cc: David Fetter <[EMAIL PROTECTED]>, Andrew Dunstan <[EMAIL PROTECTED]>, [EMAIL PROTECTED], PostgreSQL-patches Subject: Re: [PATCHES] [BUGS] BUG #2221: Bad delimiters allowed in COPY ... In-Reply-To: <[EMAIL PROTECTED]> References: <[EMAIL

Re: [PATCHES] [BUGS] BUG #2221: Bad delimiters allowed in COPY ...

2007-02-04 Thread Tom Lane
Bruce Momjian writes: > Attached is a patch that errors for \r and \n in delimiter and > null. I am not convinced that this is a bug. Can you prove that there is no use-case for asking COPY to emit data in this style? Sure, COPY itself couldn't read it, but people sometimes feed COPY output to

Re: [PATCHES] [BUGS] BUG #2221: Bad delimiters allowed in COPY ...

2006-02-01 Thread Bruce Momjian
David Fetter wrote: > On Wed, Feb 01, 2006 at 01:16:08AM -0500, Tom Lane wrote: > > Bruce Momjian writes: > > > Attached is a patch that errors for \r and \n in delimiter and > > > null. I kept the ERRCODE_FEATURE_NOT_SUPPORTED error code because > > > that is what all the other error tests use i

Re: [PATCHES] [BUGS] BUG #2221: Bad delimiters allowed in COPY ...

2006-02-01 Thread Andrew Dunstan
David Fetter wrote: Anyhow, Bruce's patch still allows backslash as a delimiter, which can cause *all* kinds of fun if not disallowed. Yes, I'm puzzled by that. I can't really see any case for allowing it. And if we do, it should only be allowed in CSV mode, where its use will be mere

Re: [PATCHES] [BUGS] BUG #2221: Bad delimiters allowed in COPY ...

2006-01-31 Thread David Fetter
On Wed, Feb 01, 2006 at 01:16:08AM -0500, Tom Lane wrote: > Bruce Momjian writes: > > Attached is a patch that errors for \r and \n in delimiter and > > null. I kept the ERRCODE_FEATURE_NOT_SUPPORTED error code because > > that is what all the other error tests use in the copy code in > > that ar

Re: [PATCHES] [BUGS] BUG #2221: Bad delimiters allowed in COPY ...

2006-01-31 Thread Tom Lane
Bruce Momjian writes: > Attached is a patch that errors for \r and \n in delimiter and null. I > kept the ERRCODE_FEATURE_NOT_SUPPORTED error code because that is what > all the other error tests use in the copy code in that area. I'd go with INVALID_PARAMETER_VALUE, I think. ISTM that FEATURE_

Re: [PATCHES] [BUGS] BUG #2221: Bad delimiters allowed in COPY ...

2006-01-31 Thread Bruce Momjian
> On Tue, Jan 31, 2006 at 09:50:26PM -0600, Andrew Dunstan wrote: > > >> Also, should we disable DELIMITER and NULL from sharing characters? > > > > > > That's on about line 916, post-patch: > > > > > >/* Don't allow the delimiter to appear in the null string. */ > > >if (strchr(cstate->nul

Re: [PATCHES] [BUGS] BUG #2221: Bad delimiters allowed in COPY ...

2006-01-31 Thread David Fetter
On Tue, Jan 31, 2006 at 09:50:26PM -0600, Andrew Dunstan wrote: > David Fetter said: > > On Tue, Jan 31, 2006 at 08:03:41PM -0500, Bruce Momjian wrote: > >> Uh, couldn't the delimiter be a backslash in CVS mode? > > > > I don't think so. Folks? > > Using backslash as a delimiter in CSV would be o

Re: [PATCHES] [BUGS] BUG #2221: Bad delimiters allowed in COPY ...

2006-01-31 Thread Andrew Dunstan
David Fetter said: > On Tue, Jan 31, 2006 at 08:03:41PM -0500, Bruce Momjian wrote: >> Uh, couldn't the delimiter be a backslash in CVS mode? > > I don't think so. Folks? Using backslash as a delimiter in CSV would be odd, to say the least. As an escape char it is occasionally used, but not as a

Re: [PATCHES] [BUGS] BUG #2221: Bad delimiters allowed in COPY ...

2006-01-31 Thread David Fetter
On Tue, Jan 31, 2006 at 08:03:41PM -0500, Bruce Momjian wrote: > Uh, couldn't the delimiter be a backslash in CVS mode? I don't think so. Folks? Anyhow, if there are different sets, I could do something like: #define BADCHARS "\r\n\\" #define BADCHARS_CSV "\r\n" and then check for csv_mode, et

Re: [PATCHES] [BUGS] BUG #2221: Bad delimiters allowed in COPY ...

2006-01-31 Thread Bruce Momjian
Uh, couldn't the delimiter be a backslash in CVS mode? + #define BADCHARS "\r\n\\" Also, should we disable DELIMITER and NULL from sharing characters? --- David Fetter wrote: > On Sun, Jan 29, 2006 at 10:20:47PM -0

Re: [PATCHES] [BUGS] BUG #2221: Bad delimiters allowed in COPY ...

2006-01-31 Thread Bruce Momjian
> Is ERRCODE_FEATURE_NOT_SUPPORTED the right errcode? This isn't a > missing feature; we are performing a sanity check here. We can > reasonably expect never to support CR, LF or \ as the text > delimiter. I guess that depends on whether we ever plan to allow people to set the output record separ

Re: [PATCHES] [BUGS] BUG #2221: Bad delimiters allowed in COPY ...

2006-01-30 Thread David Fetter
On Mon, Jan 30, 2006 at 08:21:34AM -0500, Andrew Dunstan wrote: > > > David Fetter wrote: > > > > >+/* Disallow BADCHARS characters */ > >+if (strcspn(cstate->delim, BADCHARS) != 1) > >+ereport(ERROR, > >+(errcode(ERRCODE_FEATURE_NOT_SUPPORTED), >

Re: [PATCHES] [BUGS] BUG #2221: Bad delimiters allowed in COPY ...

2006-01-30 Thread Andrew Dunstan
David Fetter wrote: + /* Disallow BADCHARS characters */ + if (strcspn(cstate->delim, BADCHARS) != 1) + ereport(ERROR, + (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), +errmsg("COPY delimiter cannot be \"%#02x\"", +

Re: [PATCHES] [BUGS] BUG #2221: Bad delimiters allowed in COPY ...

2006-01-29 Thread David Fetter
On Sun, Jan 29, 2006 at 10:20:47PM -0500, Neil Conway wrote: > On Sun, 2006-01-29 at 17:03 -0800, David Fetter wrote: > > Another followup, this time with the comment done right. > > + /* Disallow the forbidden_delimiter strings */ > + if (strcspn(cstate->delim, BADCHARS) != 1) > +

Re: [PATCHES] [BUGS] BUG #2221: Bad delimiters allowed in COPY ...

2006-01-29 Thread Neil Conway
On Sun, 2006-01-29 at 17:03 -0800, David Fetter wrote: > Another followup, this time with the comment done right. + /* Disallow the forbidden_delimiter strings */ + if (strcspn(cstate->delim, BADCHARS) != 1) + elog(ERROR, "COPY delimiter cannot be %#02x", +

Re: [PATCHES] [BUGS] BUG #2221: Bad delimiters allowed in COPY ... TO

2006-01-29 Thread David Fetter
On Sun, Jan 29, 2006 at 04:41:43PM -0800, David Fetter wrote: > On Sun, Jan 29, 2006 at 09:50:08PM +, David Fetter wrote: > > > > The following bug has been logged online: > > > > Bug reference: 2221 > > Logged by: David Fetter > > Email address: [EMAIL PROTECTED] > > Postg

Re: [PATCHES] [BUGS] BUG #2221: Bad delimiters allowed in COPY ... TO

2006-01-29 Thread David Fetter
On Sun, Jan 29, 2006 at 09:50:08PM +, David Fetter wrote: > > The following bug has been logged online: > > Bug reference: 2221 > Logged by: David Fetter > Email address: [EMAIL PROTECTED] > PostgreSQL version: all > Operating system: all > Description:Bad delimit