Re: Strange behavior of "=" as assignment operator

From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: Stephen Frost <sfrost(at)snowman(dot)net>
Cc: Moshe Jacobson <moshe(at)neadwerx(dot)com>, pgsql-general <pgsql-general(at)postgresql(dot)org>, Stephen Dolan <stephen(at)neadwerx(dot)com>
Subject: Re: Strange behavior of "=" as assignment operator
Date: 2013-05-28 20:11:11
Message-ID: CAFj8pRAhWCokhiesrAD=QSwm=XiMzrMRpgsSn_g7=WuVS-dZEg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

2013/5/28 Stephen Frost <sfrost(at)snowman(dot)net>:
> * Moshe Jacobson (moshe(at)neadwerx(dot)com) wrote:
>> It seems that the comparison operator "=" is functioning as the assignment
>> operator ":=" in this plpgsql trigger script I wrote. I was under the
>> impression that "=" is only for comparison and not assignment. If this is
>> true, please explain the transcript below. If it's not true, where is this
>> documented? I'm using PostgreSQL 9.1.4.
>
> Both are supported. It's not really documented as using '=' is
> considered 'legacy' but it's also extensively used and removing it would
> break quite a bit of code for people.
>
> My general feeling is that we should either document it *as* legacy
> or add it to the "list-of-things-to-break-in-10.0". :)

should be cleaned and removed

same undocumented behave has GET DIAGNOSTICS STATEMENT, ":=" is
allowed there :-(

note from source code

assign_operator>: '='<->/* not documented because it might be removed someday */
<------><------><------><------>| COLON_EQUALS
<------><------><------><------>;

Regards

Pavel

>
> Thanks,
>
> Stephen

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Moshe Jacobson 2013-05-28 20:17:35 Re: Strange behavior of "=" as assignment operator
Previous Message Stephen Frost 2013-05-28 20:06:39 Re: Strange behavior of "=" as assignment operator