Skip site navigation (1) Skip section navigation (2)

Re: An amusing MySQL weakness--not!

From: Gavin Flower <GavinFlower(at)archidevsys(dot)co(dot)nz>
To: Michael Nolan <htfoot(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: An amusing MySQL weakness--not!
Date: 2011-06-26 05:43:26
Message-ID: 4E06C6FE.8060701@archidevsys.co.nz (view raw or flat)
Thread:
Lists: pgsql-general
On 26/06/11 16:44, Michael Nolan wrote:
> Earlier today I was working on a MySQL database (not by choice, I 
> assure you),
> and I typed a statement like this:
>
> Update tablexyz set field1 = '15' where field2 - 20;
>
> The '-' was supposed to be an equal sign, but MySQL executed it 
> anyway.  (Field2 is an integer.)
>
> I was not amused.
>
> PostgreSQL reports this as an error, of course.
> --
> Mike Nolan
> nolan(at)tssi(dot)com <mailto:nolan(at)tssi(dot)com>

I am guessing that '(field2 - 20)' is evaluated, and if non-zero it is 
treated as true?

In response to

pgsql-general by date

Next:From: Darren DuncanDate: 2011-06-26 07:05:58
Subject: Re: An amusing MySQL weakness--not!
Previous:From: Randal L. SchwartzDate: 2011-06-26 04:53:41
Subject: Re: An amusing MySQL weakness--not!

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group