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

From Hannu Krosing
Subject Re: PL/pgSQL 'i = i + 1' Syntax
Date
Msg-id 1147896157.3889.6.camel@localhost.localdomain
Whole thread Raw
In response to Re: PL/pgSQL 'i = i + 1' Syntax  (Josh Berkus <josh@agliodbs.com>)
Responses Re: PL/pgSQL 'i = i + 1' Syntax  (Andrew Dunstan <andrew@dunslane.net>)
List pgsql-hackers
Ühel kenal päeval, K, 2006-05-17 kell 10:22, kirjutas Josh Berkus:
> Tom,
> 
> > True, but there were clear benefits from doing so.  Disallowing "="
> > assignment in plpgsql wouldn't buy anything, just break programs.
> 
> But it's already disallowed in most places.   The i = i + 1 seems to be an 
> exception.   
> 
> So what happens to "i" if I do:
> 
> IF i = i + 1 THEN ....
> 
> does "i" increment?   If so, isn't that a bug? 
> 
> I don't think too many people are using that functionality intentionally; I 
> probably write more PL/pgSQL than anyone and would regard any assignment 
> without ":=" as a bug.

I do occasionally write some pl/pgSQL, and have at some points written a
lot of it. And most of it uses = instead of := , including all code
written during last 1.5 years. 

Once I found out that = works for assignment, i completely stopped
using := .I have treated := as "deprecated" for some time already.

So allowing only := for assignment would make me very sad .

-- 
----------------
Hannu Krosing
Database Architect
Skype Technologies OÜ
Akadeemia tee 21 F, Tallinn, 12618, Estonia

Skype me:  callto:hkrosing
Get Skype for free:  http://www.skype.com




pgsql-hackers by date:

Previous
From: Hannu Krosing
Date:
Subject: Re: Compression and on-disk sorting
Next
From: "Jim C. Nasby"
Date:
Subject: Re: PL/pgSQL 'i = i + 1' Syntax