On Fri, 12 Sep 2003, Tom Lane wrote:
> I'm currently leaning to an idea that was suggested yesterday by (I
> think) Andreas: let the quote start marker be a token of the form
> dollarsign zero-or-more-letters dollarsign
> and let the quote body extend to the next occurrence of the identical
> string. For example
> ... $Q$Joe's house$Q$ ...
> is equivalent to
> ... 'Joe''s house' ...
>
> This is extremely compact for quoting strings that don't contain any
> doubled dollar signs, since you don't need any letters at all. I could
> see $$text$$ becoming a very common way to quote material that contains
> single quotes or backslashes. But since you can choose any string of
> letters to make up the terminating token, the mechanism is able to quote
> any text whatever, including nested occurrences of the same structure
> (with a different letterstring of course).
>
> Note that there is no particular need to insist on any nearby newlines.
> If the construct is written just following an identifier or keyword,
> then you do need some intervening whitespace to keep the $Q$ from being
> read as part of that identifier, but I doubt this will bother anyone.
And it's still far less onerous a requirement than here documents have
with their newlines.
> Note that I'm allowing only letters, not digits, in the string; this
> avoids any possible ambiguity with $n parameter tokens. We have no
> other SQL tokens that are allowed to start with $, so this creates no
> other lexical ambiguity.
I like it.
Bruce said:
> Sounds interesting. So it is $$text$$ or $quote$text$quote$?
Either way, as I understand the proposal.
Jon