Re: massive quotes? - Mailing list pgsql-hackers

From Tom Lane
Subject Re: massive quotes?
Date
Msg-id 354.1063309126@sss.pgh.pa.us
Whole thread Raw
In response to Re: massive quotes?  (Bruce Momjian <pgman@candle.pha.pa.us>)
Responses Re: massive quotes?  (Jon Jensen <jon@endpoint.com>)
Re: massive quotes?  (Andrew Dunstan <andrew@dunslane.net>)
List pgsql-hackers
Bruce Momjian <pgman@candle.pha.pa.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


pgsql-hackers by date:

Previous
From: Andrew Dunstan
Date:
Subject: Re: massive quotes?
Next
From: Jon Jensen
Date:
Subject: Re: massive quotes?