Tom Lane wrote: > Bruce Momjian <[EMAIL PROTECTED]> 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 [EMAIL PROTECTED] | (610) 359-1001 + If your life is a hard drive, | 13 Roberts Road + Christ can be your backup. | Newtown Square, Pennsylvania 19073 ---------------------------(end of broadcast)--------------------------- TIP 2: you can get off all lists at once with the unregister command (send "unregister YourEmailAddressHere" to [EMAIL PROTECTED])