Re: massive quotes? - Mailing list pgsql-hackers

From Tom Lane
Subject Re: massive quotes?
Date
Msg-id 1696.1063315714@sss.pgh.pa.us
Whole thread Raw
In response to Re: massive quotes?  (Bruce Momjian <pgman@candle.pha.pa.us>)
Responses Re: massive quotes?
Re: massive quotes?
List pgsql-hackers
Bruce Momjian <pgman@candle.pha.pa.us> writes:
> Tom Lane wrote:
>> The $$FOO proposal I put forward earlier was consciously modeled on
>> here-documents.

> Couldn't we allow << at the beginning of the line to mean 'here' document?

No; you could easily be breaking existing queries, for example

regression=# select f1, f1 << 8 from int4_tbl;    f1      | ?column?
-------------+-----------          0 |         0     123456 |  31604736    -123456 | -31604736 2147483647 |
-256-2147483647|       256
 
(5 rows)

is only one unfortunate choice of line break away from being eaten by
such a proposal.

I suggested $$ because AFAIK we don't currently have any valid syntax
that would allow that to appear at the start of a line (it helps a great
deal that we just removed $ from the set of characters allowed in
operators ;-)).  If you consider my $$FOO proposal to include the
possibility of a zero-length FOO string, then the shortest legal
alternative would be
$$string contents here$$

but adding a string to that reduces the odds of conflict (especially
when you consider languages like plperl; IIRC, $$ is something or other
useful in Perl).  Also you can use mnemonically-chosen strings; maybe
Andreas will like
$$FUNCTIONBODYtext here$$FUNCTIONBODY
        regards, tom lane


pgsql-hackers by date:

Previous
From: Jan Wieck
Date:
Subject: Re: massive quotes?
Next
From: Bruce Momjian
Date:
Subject: Re: massive quotes?