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

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: PL/pgSQL 'i = i + 1' Syntax
Дата
Msg-id 19568.1147875099@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: PL/pgSQL 'i = i + 1' Syntax  ("Andrew Dunstan" <andrew@dunslane.net>)
Ответы Re: PL/pgSQL 'i = i + 1' Syntax
Re: PL/pgSQL 'i = i + 1' Syntax
Список pgsql-hackers
"Andrew Dunstan" <andrew@dunslane.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


В списке pgsql-hackers по дате отправления:

Предыдущее
От: Bruce Momjian
Дата:
Сообщение: Re: What default is - SET behavior
Следующее
От: Cristiano Duarte
Дата:
Сообщение: Re: [BUGS] BUG #2429: Explain does not report object's schema