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

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Andrew Dunstan" <andrew(at)dunslane(dot)net>
Cc: all(at)adv(dot)magwien(dot)gv(dot)at, pgsql-hackers(at)postgresql(dot)org
Subject: Re: PL/pgSQL 'i = i + 1' Syntax
Date: 2006-05-17 14:11:39
Message-ID: 19568.1147875099@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

"Andrew Dunstan" <andrew(at)dunslane(dot)net> writes:
> Albe Laurenz said:
>> ERROR at line 3:
>> ORA-06550: line 3, column 7:
>> PLS-00363: expression 'I' cannot be used as an assignment target
>> ORA-06550: line 3, column 7:
>> PL/SQL: Statement ignored
>>
>> And the documentation also explicitly states that it is not allowed.

> So should we if it can be done conveniently. That might be a big IF - IIRC
> many Pascal compilers ignore the similar language rule because implementing
> it is a pain in the neck.

Since we already have the notion of a "const" variable in plpgsql,
I think it might work to just mark the loop variable as const.

>> By the way, PL/SQL screams if you want to do an assignment with '='.
>> But I guess that the current behaviour of PL/pgSQL should not reflect
>> that to maintain backward compatibility, right?

> I think it should. The current behaviour is undocumented and more than icky.

The lack of documentation is easily fixed ;-). I don't think this is
icky enough to justify breaking all the existing functions we'd
undoubtedly break if we changed it.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Cristiano Duarte 2006-05-17 14:19:01 Re: [BUGS] BUG #2429: Explain does not report object's schema
Previous Message Tom Lane 2006-05-17 14:01:18 Re: does wal archiving block the current client connection?