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

Поиск
Список
Период
Сортировка
От Hannu Krosing
Тема Re: PL/pgSQL 'i = i + 1' Syntax
Дата
Msg-id 1147900699.3889.28.camel@localhost.localdomain
обсуждение исходный текст
Ответ на Re: PL/pgSQL 'i = i + 1' Syntax  (Andrew Dunstan <andrew@dunslane.net>)
Ответы Re: PL/pgSQL 'i = i + 1' Syntax
Список pgsql-hackers
Ühel kenal päeval, K, 2006-05-17 kell 16:31, kirjutas Andrew Dunstan:
> Hannu Krosing wrote:
> >> 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 .
> >   
> 
> I can only comment that that seems crazy.
> 
> := is
> . documented
> . consistent with pl/sql and ancestors

OTOH 
* = is used in CONST declaration in PASCAL, whereas pl/pgSQL  documents := (i.e. ASSIGNMENT) for const declaration
* = is used by everybody else for assignment. It can be argued that the reason it is not used in pure SQL for
assignmentis just that SQL lacks assignment.
 
* weather = is assignment statement or comparison operator is always clear from position, that is pl/pgsql does not
haveresult for assignment statement, so everywhere the value of "A = B" is used,  it must be comparison operator,
whereaswhen its value is not used it must be statement. So no disambiguity.
 



> Even C doesn't use the same operator for assignment and comparison.

It can't, as in C both assignment and comparison are operators, so it 
allows you to use result of both as boolean.

> Sometimes I wonder if large parts of the IT world is trying to pretend 
> that the Algol family never existed.

And even bigger part is trying to pretend that LISP and Prolog never
existed ;) And don't forget about QUEL and PostQUEL either.

-- 
----------------
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 по дате отправления:

Предыдущее
От: "Jim C. Nasby"
Дата:
Сообщение: Cross-version dumps (was: [DOCS] Mention pg_dump version portability)
Следующее
От: "Andrew Dunstan"
Дата:
Сообщение: Re: PL/pgSQL 'i = i + 1' Syntax