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

Поиск
Список
Период
Сортировка
От Douglas McNaught
Тема Re: PL/pgSQL 'i = i + 1' Syntax
Дата
Msg-id 87hd3mj197.fsf@suzuka.mcnaught.org
обсуждение исходный текст
Ответ на Re: PL/pgSQL 'i = i + 1' Syntax  (Mark Dilger <pgsql@markdilger.com>)
Ответы Re: PL/pgSQL 'i = i + 1' Syntax
Re: PL/pgSQL 'i = i + 1' Syntax
Список pgsql-hackers
Mark Dilger <pgsql@markdilger.com> writes:

> 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:

That's because (AIUI) all expressions to be evaluated are handed off
to the SQL parser (why re-implement all that logic and have subtle and
annoying differences?)  plpgsql only handles the statements, loops, etc.
So it doesn't care about the difference but SQL does...

Not that I claim that makes sense.  :)

-Doug


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

Предыдущее
От: Marc Munro
Дата:
Сообщение: New feature proposal
Следующее
От: Mark Dilger
Дата:
Сообщение: Re: PL/pgSQL 'i = i + 1' Syntax