Re: massive quotes? - Mailing list pgsql-hackers

From Bruce Momjian
Subject Re: massive quotes?
Date
Msg-id 200309111851.h8BIpoi23263@candle.pha.pa.us
Whole thread Raw
In response to Re: massive quotes?  (Andreas Pflug <pgadmin@pse-consulting.de>)
Responses Re: massive quotes?
Re: massive quotes?
List pgsql-hackers
Andreas Pflug wrote:
> Sergio A. Kessler wrote:
> 
> 
> >
> > Too sad, all special chars are used up for operators....
> 
> 
>  also '{' '}' are used ?
> 
> I've only seen this in ACLs, so it might be usable. Tom, Bruce?

Something that includes "'" would be clearest. I thought of <' and '>,
but this would break:
if var <'yes'

I think {' and '} might work.  Arrays are specified as '{val, val}',
which is safe because it is opposite of the suggested syntax.  I can't
think of any case where you would use an opening brace, then a single
quote.  Interestingly, it looks like a C braces:
CREATE FUNCTION test() ...{'    x = 'no';'}

Of course, this brings up a problem.  What if we do:

CREATE FUNCTION test() ...{'    x = '}text';'}

Oops, two closing mega-quotes.

One clean way would be to use {' to start a quote, and }' to end it, so
we have:

CREATE FUNCTION test() ...{'    x = 'text';}'

which looks even better and this is safe because both braces in '}text}'
are seen in a quoted string:
CREATE FUNCTION test() ...{'    x = '}text}';}'

Also, I can't imagine anyone defining those as operators.

--  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: Andreas Pflug
Date:
Subject: Re: massive quotes?
Next
From: Bruce Momjian
Date:
Subject: Re: Another small bug (pg_autovacuum)