Re: massive quotes?

From: Jon Jensen <jon(at)endpoint(dot)com>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Re: massive quotes?
Date: 2003-09-12 14:00:03
Message-ID: Pine.LNX.4.58.0309121357450.2849@louche.swelter.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2003-09-12 14:10:20 Re: massive quotes?
Previous Message Bruce Momjian 2003-09-12 13:59:41 Re: [PATCHES] Reorganization of spinlock defines