Re: massive quotes?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
Cc: Andreas Pflug <pgadmin(at)pse-consulting(dot)de>, ser(at)kessler(dot)com(dot)ar, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: massive quotes?
Date: 2003-09-11 19:38:46
Message-ID: 354.1063309126@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us> writes:
> Something that includes "'" would be clearest. I thought of <' and '>,
> but this would break:
> if var <'yes'

People seem to be assuming that this feature needs to be impervious to
whitespace and being adjacent to other things. I believe we could make
it a good deal more robust if both the opening and closing markers
(whatever they are) are required to stand alone on a line. For example

{'
}'

represents the empty string, and

{'
x = 'text';
}'

represents '\tx = \'text\';'. I think the rule would need to be that
the newline just after the opening marker, and the newline just before
the closing marker, are not included in the resulting string literal.

The point is we don't have to make case like {'xxx}' be recognized as an
occurrence of this construct, and on the whole I think it's a lot safer
if we don't. Keep in mind that the string you are trying to quote is
often code in a language that is not SQL. Therefore, choosing markers
on the grounds that they won't appear in SQL is not good enough.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Jon Jensen 2003-09-11 19:56:09 Re: massive quotes?
Previous Message Andrew Dunstan 2003-09-11 19:29:45 Re: massive quotes?