Re: massive quotes?

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Andreas Pflug <pgadmin(at)pse-consulting(dot)de>
Cc: ser(at)kessler(dot)com(dot)ar, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: massive quotes?
Date: 2003-09-11 18:51:50
Message-ID: 200309111851.h8BIpoi23263@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2003-09-11 19:02:23 Re: Another small bug (pg_autovacuum)
Previous Message Andreas Pflug 2003-09-11 18:31:15 Re: massive quotes?