From: | Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | Jon Jensen <jon(at)endpoint(dot)com>, pgsql-hackers(at)postgresql(dot)org |
Subject: | Re: massive quotes? |
Date: | 2003-09-11 21:37:26 |
Message-ID: | 200309112137.h8BLbQJ10343@candle.pha.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Tom Lane wrote:
> Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)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
Yes, that is true. I didn't like the beginning-of-line requirement for
here documents for that reason. However, we are already requiring the
thing to be at the beginning of the line. You are saying it is safer to
make it at the beginnning of a line _and_ have it be something that
isn't used in SQL, but $$ is used in Perl, so I don't see the big
advantage either way --- once you say X has to begin at the beginning of
the line, we are already making things breakable by a newline, no?
You could make the point that using $$ makes only the text inside the
quote as newline-sensitive, while using << makes any SQL
newline-sensitive, and that might be the major advantage of something
like $$.
To me, however, the dollar sign is just too overloaded for function
arguments, which you will likely see in the function text.
> 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
Of course, every operator combination is used by Perl. :-)
> Andreas will like
>
> $$FUNCTIONBODY
> text here
> $$FUNCTIONBODY
So you are requiring the identical text to appear at the beginning and
end of the quote, rather than a here document that would be:
<<END
...
END
or in your example:
$$END
...
END
--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073
From | Date | Subject | |
---|---|---|---|
Next Message | Jon Jensen | 2003-09-11 21:42:32 | Re: massive quotes? |
Previous Message | Bruce Momjian | 2003-09-11 21:28:52 | Re: massive quotes? |