Re: Fwd: [HACKERS] polite request about syntax

2006-09-15 Thread Alvaro Herrera
Ricardo Malafaia wrote:
> On 9/15/06, Douglas McNaught <[EMAIL PROTECTED]> wrote:
> >> What happens then when it sees something like a double variable
> >> interpolation as in $$foobar? ;)
> >
> >Then you use $FOO$ (or something else that doesn't appear in your
> >code) as the delimiter--you're not limited to just $$.
> 
> clever.  still, i don't believe such variety of syntax and even
> multitude of language support would do well with most Windows shops.
> but that's not really your fault...

Well, there's always MS Access ...

-- 
Alvaro Herrerahttp://www.CommandPrompt.com/
PostgreSQL Replication, Consulting, Custom Development, 24x7 support

---(end of broadcast)---
TIP 4: Have you searched our list archives?

   http://archives.postgresql.org


Re: Fwd: [HACKERS] polite request about syntax

2006-09-15 Thread Andrew Dunstan

Ricardo Malafaia wrote:


And the $$ is indeed needed for allowing languages with different
syntaxes.  agreed.  However, Tom, i could counter example your plperl
example:


realize that qq/end/ does not represent a matching "end"?


What happens then when it sees something like a double variable
interpolation as in $$foobar? ;)




The delimiter does not have to be $$. It can be 
$any_unquoted_identifier_without_a_dollar_sign$.


the lexer says:

/* $foo$ style quotes ("dollar quoting")
* The quoted string starts with $foo$ where "foo" is an optional string
* in the form of an identifier, except that it may not contain "$",
* and extends to the first occurrence of an identical string. 
* There is *no* processing of the quoted text.

*
*/
dolq_start  [A-Za-z\200-\377_]
dolq_cont   [A-Za-z\200-\377_0-9]
dolqdelim   \$({dolq_start}{dolq_cont}*)?\$


So for a plperl function you just use something like $func$ at each end.

cheers

andrew



---(end of broadcast)---
TIP 6: explain analyze is your friend


Re: Fwd: [HACKERS] polite request about syntax

2006-09-15 Thread Ricardo Malafaia

On 9/15/06, Douglas McNaught <[EMAIL PROTECTED]> wrote:

> What happens then when it sees something like a double variable
> interpolation as in $$foobar? ;)

Then you use $FOO$ (or something else that doesn't appear in your
code) as the delimiter--you're not limited to just $$.


clever.  still, i don't believe such variety of syntax and even
multitude of language support would do well with most Windows shops.
but that's not really your fault...

---(end of broadcast)---
TIP 6: explain analyze is your friend


Re: Fwd: [HACKERS] polite request about syntax

2006-09-15 Thread Douglas McNaught
"Ricardo Malafaia" <[EMAIL PROTECTED]> writes:

> What happens then when it sees something like a double variable
> interpolation as in $$foobar? ;)

Then you use $FOO$ (or something else that doesn't appear in your
code) as the delimiter--you're not limited to just $$.

-Doug

---(end of broadcast)---
TIP 6: explain analyze is your friend


Fwd: [HACKERS] polite request about syntax

2006-09-15 Thread Ricardo Malafaia

-- Forwarded message --
From: Ricardo Malafaia <[EMAIL PROTECTED]>
Date: Sep 15, 2006 1:28 PM
Subject: Re: [HACKERS] polite request about syntax
To: Tom Lane <[EMAIL PROTECTED]>


ok, guys. i guess i was a bit unfair.  Timestamp is used everywhere
indeed, Oracle, Firebird you name it.  Only MySQL followed M$ and
added a confusing datetime and date to the mix.  I hope, though, that
the "timestamp with timezone" isn't really necessary.

And the $$ is indeed needed for allowing languages with different
syntaxes.  agreed.  However, Tom, i could counter example your plperl
example:


realize that qq/end/ does not represent a matching "end"?


What happens then when it sees something like a double variable
interpolation as in $$foobar? ;)

Sorry for the rudeness, but i truly like PostgreSQL and was playing
devil's advocate.  and no, i'm not likely to have fun with Oracle...
:P

cheers


--
http://slashdot.org

---(end of broadcast)---
TIP 3: Have you checked our extensive FAQ?

  http://www.postgresql.org/docs/faq