Re: PL/pgSQL 'i = i + 1' Syntax

From: Hannu Krosing <hannu(at)skype(dot)net>
To: josh(at)agliodbs(dot)com
Cc: pgsql-hackers(at)postgresql(dot)org, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Andrew Dunstan <andrew(at)dunslane(dot)net>, all(at)adv(dot)magwien(dot)gv(dot)at
Subject: Re: PL/pgSQL 'i = i + 1' Syntax
Date: 2006-05-17 20:02:37
Message-ID: 1147896157.3889.6.camel@localhost.localdomain
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Jim C. Nasby 2006-05-17 20:12:38 Re: PL/pgSQL 'i = i + 1' Syntax
Previous Message Hannu Krosing 2006-05-17 19:55:19 Re: Compression and on-disk sorting