On Tue, 2007-10-09 at 12:13 -0700, David Fetter wrote:
> On Tue, Oct 09, 2007 at 11:48:35AM -0700, Jeff Davis wrote:
> > On Tue, 2007-10-09 at 09:44 +0200, Kaare Rasmussen wrote:
> > > > In SQL, "=" is both an assignment operator (e.g. UPDATE) and a
> > > > comparison operator (e.g. WHERE clause). There are
> > > > nondeterministic
> > >
> > > Why would that be a problem when they occur in different parts of
> > > the statement?
> >
> > It can actually be in the same part of the statement:
> >
> > UPDATE foo SET b = a = 0;
>
> Don't Do That(TM).
Right, I don't; it was completely contrived. I am not making any attempt
to be elegant with such a statement.
I'm just trying to point out that, if there's a complex update statement
it might do something unexpected if you have a bug. Other languages have
different assignment and comparison operators to avoid these situations,
and I think it helps people catch bugs (and makes it easier to parse,
I'm sure).
Regards,
Jeff Davis