Re: Escape handling in COPY, strings, psql - Mailing list pgsql-hackers

From Bruce Momjian
Subject Re: Escape handling in COPY, strings, psql
Date
Msg-id 200505291330.j4TDU6C10539@candle.pha.pa.us
Whole thread Raw
In response to Escape handling in COPY, strings, psql  (Bruce Momjian <pgman@candle.pha.pa.us>)
Responses Re: Escape handling in COPY, strings, psql  (Tom Lane <tgl@sss.pgh.pa.us>)
Re: Escape handling in COPY, strings, psql  (Peter Eisentraut <peter_e@gmx.net>)
List pgsql-hackers
Bruce Momjian wrote:
> Tom Lane wrote:
> > Bruce Momjian <pgman@candle.pha.pa.us> writes:
> > > Here is an updated version of the COPY \x patch.  It is the first patch
> > > attached.
> > > Also, I realized that if we support \x in COPY, we should also support
> > > \x in strings to the backend.  This is the second patch.
> > 
> > Do we really want to do any of these things?  We've been getting beaten
> > up recently about the fact that we have non-SQL-spec string escapes
> > (ie, all the backslash stuff) so I'm a bit dubious about adding more,
> > especially when there's little if any demand for it.
> 
> I thought about that, but adding additional escape letters isn't our
> problem --- it is the escape mechanism itself that is the issue.
> 
> I have wanted to post on this issue so now is a good time.  I think we
> have been validly beaten up in that we pride ourselves on standards
> compliance but have escape requirement on all strings.  Our string
> escapes are a major problem --- not the number of them but the
> requirement to double backslashes on input, like 'C:\\tmp'.  I am
> thinking the only clean solution is to add a special keyword like ESCAPE
> before strings that contain escape information.  I think a GUC is too
> general.  You know if the string is a constant if it contains escapes
> just by looking at it, and if it is a variable, hopefully you know if it
> has escapes.  
> 
> Basically, I think we have to deal with this somehow. I think it could
> be implemented by looking for the ESCAPE keyword in parser/scan.l and
> handling it all in there by ignoring backslash escapes if ESCAPE
> preceeds the string.  By the time you are in gram.y, it is too late.

One other idea would be to remove escape processing for single-quoted
strings but keep it for our $$ strings, becuase they are not ANSI
standard.

--  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,
Pennsylvania19073
 


pgsql-hackers by date:

Previous
From: Peter Eisentraut
Date:
Subject: Re: Escape handling in COPY, strings, psql
Next
From: Hannu Krosing
Date:
Subject: compiling postgres with Visual Age compiler on OpenPower5 / Linux