Re: PL/pgSQL 'i = i + 1' Syntax - Mailing list pgsql-hackers

From Andreas Seltenreich
Subject Re: PL/pgSQL 'i = i + 1' Syntax
Date
Msg-id 87zmhevojb.fsf@gate450.dyndns.org
Whole thread Raw
In response to Re: PL/pgSQL 'i = i + 1' Syntax  (Mark Dilger <pgsql@markdilger.com>)
List pgsql-hackers
Mark Dilger schrob:

> Tom Lane wrote:
>> No it isn't.  The plpgsql scanner treats := and = as *the same token*.
>> They can be interchanged freely.  This has nothing to do with the case
>> of modifying a loop variable in particular.
>
> I disagree.  If the scanner treated them the same, then
>
>   if i := 1 then ...
>
> would work, but it doesn't.  The := is rejected in a conditional.  Try the
> following code if you don't believe me:

You're confusing the PL/pgSQL scanner with the SQL
scanner. Expressions in PL/pgSQL are handed down to the SQL parser.

regards,
andreas


pgsql-hackers by date:

Previous
From: Robert Treat
Date:
Subject: Re: [OT] MySQL is bad, but THIS bad?
Next
From: Marc Munro
Date:
Subject: New feature proposal