Re: [GENERAL] Strange behavior of "=" as assignment operator

2013-06-01 Thread Kevin Grittner
Tom Lane wrote: > The SQL standard uses "=" for assignment in other contexts, > most notably UPDATE, but also the SQL/PSM standard uses it in > which is the exact same thing as in > pl/pgsql.  So while purists might wish we only accepted :=, doing > so would be inconsistent with SQL. > > I think

Re: [GENERAL] Strange behavior of "=" as assignment operator

2013-06-01 Thread Tom Lane
David Johnston writes: > A bogus warning is nearly as bad as simply disallowing the syntax in the > first place and I do not like turning one on unless there is the decision to > disallow the syntax in the future. TBH I do not see this happening. GET DIAGNOSTICS is just the tip of the iceberg.

Re: [GENERAL] Strange behavior of "=" as assignment operator

2013-06-01 Thread David Johnston
Chris Travers-5 wrote > My preference would be that at some point we start adding warnings when = > is used as an assignment. Such warnings could be turned off. Then at > some > later point we can decide whether to change the behavior. A decision to > changing the language would be different if

Re: [GENERAL] Strange behavior of "=" as assignment operator

2013-06-01 Thread Pavel Stehule
> > A comment was made that "GET DIAGNOSTICS var = item;" is standard defined. > Is the use of ":=" for assignment also standard defined? If so its not that > inconsistent standards surprise me but...anyway. ":=" coming from different world (ALGOL like languages) and is never used in SQL. Oracle

Re: [GENERAL] Strange behavior of "=" as assignment operator

2013-06-01 Thread Chris Travers
On Sat, Jun 1, 2013 at 2:52 AM, David Johnston wrote: > Chris Travers-5 wrote > > However = as assignment is particularly odd to me for two reasons. First > > it is not ambiguous but it leads to difficult to read constructs, like > > this: > > > >out_var = in_left = in_right; > > Agreed but

Re: [GENERAL] Strange behavior of "=" as assignment operator

2013-06-01 Thread David Johnston
Chris Travers-5 wrote > However = as assignment is particularly odd to me for two reasons. First > it is not ambiguous but it leads to difficult to read constructs, like > this: > >out_var = in_left = in_right; Agreed but the genie is already out of the bottle and I am OK with something at t

Re: [GENERAL] Strange behavior of "=" as assignment operator

2013-06-01 Thread Pavel Stehule
2013/6/1 Chris Travers : > Agreed about undocumented behavior (actually there is a *lot* of > undocumented behavior in PostgreSQL as I have slowly found out-- if you want > to see a lot of it, go look at the pg_dump source code). > > However = as assignment is particularly odd to me for two reasons

Re: [GENERAL] Strange behavior of "=" as assignment operator

2013-06-01 Thread Chris Travers
Agreed about undocumented behavior (actually there is a *lot* of undocumented behavior in PostgreSQL as I have slowly found out-- if you want to see a lot of it, go look at the pg_dump source code). However = as assignment is particularly odd to me for two reasons. First it is not ambiguous but i

Re: [GENERAL] Strange behavior of "=" as assignment operator

2013-06-01 Thread Pavel Stehule
2013/6/1 David Johnston : > Tom Lane-2 wrote >> Stephen Frost < > >> sfrost@ > >> > writes: >>> * Moshe Jacobson ( > >> moshe@ > >> ) wrote: Any PG committers who can change this in 9.3? >> >>> It will certainly not be changed for 9.3. >> >> IMO, if we do anything about this at all, it should

Re: [GENERAL] Strange behavior of "=" as assignment operator

2013-05-31 Thread David Johnston
Tom Lane-2 wrote > Stephen Frost < > sfrost@ > > writes: >> * Moshe Jacobson ( > moshe@ > ) wrote: >>> Any PG committers who can change this in 9.3? > >> It will certainly not be changed for 9.3. > > IMO, if we do anything about this at all, it should be to document the > "=" option not remov

Re: [GENERAL] Strange behavior of "=" as assignment operator

2013-05-31 Thread Pavel Stehule
2013/6/1 Tom Lane : > Stephen Frost writes: >> * Moshe Jacobson (mo...@neadwerx.com) wrote: >>> Any PG committers who can change this in 9.3? > >> It will certainly not be changed for 9.3. > > IMO, if we do anything about this at all, it should be to document the > "=" option not remove it. If we

Re: [GENERAL] Strange behavior of "=" as assignment operator

2013-05-31 Thread Tom Lane
Stephen Frost writes: > * Moshe Jacobson (mo...@neadwerx.com) wrote: >> Any PG committers who can change this in 9.3? > It will certainly not be changed for 9.3. IMO, if we do anything about this at all, it should be to document the "=" option not remove it. If we change it, the squawks from pe

Re: [GENERAL] Strange behavior of "=" as assignment operator

2013-05-28 Thread Pavel Stehule
2013/5/28 Steve Crawford : > On 05/28/2013 01:06 PM, Stephen Frost wrote: >> >> * Moshe Jacobson (mo...@neadwerx.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 >>> impressio

Re: [GENERAL] Strange behavior of "=" as assignment operator

2013-05-28 Thread Pavel Stehule
Hello 2013/5/28 Moshe Jacobson : > On Tue, May 28, 2013 at 4:06 PM, Stephen Frost wrote: >> >> 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. > > > This is crazy!

Re: [GENERAL] Strange behavior of "=" as assignment operator

2013-05-28 Thread Steve Crawford
On 05/28/2013 01:06 PM, Stephen Frost wrote: * Moshe Jacobson (mo...@neadwerx.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

Re: [GENERAL] Strange behavior of "=" as assignment operator

2013-05-28 Thread Stephen Frost
* Moshe Jacobson (mo...@neadwerx.com) wrote: > Any PG committers who can change this in 9.3? It will certainly not be changed for 9.3. As suggested, perhaps in 10.0, but I tend to doubt it. It will certainly be mentioned in the release notes when it happens. Thanks, Ste

Re: [GENERAL] Strange behavior of "=" as assignment operator

2013-05-28 Thread Moshe Jacobson
On Tue, May 28, 2013 at 4:06 PM, Stephen Frost wrote: > 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. > This is crazy! By leaving it in, they are allowing my obsol

Re: [GENERAL] Strange behavior of "=" as assignment operator

2013-05-28 Thread Pavel Stehule
2013/5/28 Stephen Frost : > * Moshe Jacobson (mo...@neadwerx.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 i

Re: [GENERAL] Strange behavior of "=" as assignment operator

2013-05-28 Thread Stephen Frost
* Moshe Jacobson (mo...@neadwerx.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 tr

[GENERAL] Strange behavior of "=" as assignment operator

2013-05-28 Thread Moshe Jacobson
Dear PostgreSQL gurus, 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 t