"IF"
am 14.03.2011 14:55:55 von (Sándor Halász) hsv
Does the _function_ 'IF' always evaluate its arguments? or only the two that it is needful to evaluate?
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/mysql?unsub=gcdmg-mysql-2@m.gmane.org
Re: "IF"
am 14.03.2011 16:08:07 von Johan De Meersman
----- Original Message -----
> From: "Sándor Halász"
>
> Does the _function_ 'IF' always evaluate its arguments? or only the
> two that it is needful to evaluate?
I'm afraid I'm not authoritative on this, but it seems to me that it would =
be very very bad if the third, unused expression were to be evaluated - not=
only from a performance point of view, but who is to say that that express=
ion is not a user-defined function that modifies the database ?
--
Bier met grenadyn
Is als mosterd by den wyn
Sy die't drinkt, is eene kwezel
Hy die't drinkt, is ras een ezel
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/mysql?unsub=3Dgcdmg-mysql-2@m.gmane.o rg
Re: "IF"
am 15.03.2011 01:52:15 von (Sándor Halász) hsv
>>>> 2011/03/14 16:08 +0100, Johan De Meersman >>>>
I'm afraid I'm not authoritative on this, but it seems to me that it would be very very bad if the third, unused expression were to be evaluated - not only from a performance point of view, but who is to say that that expression is not a user-defined function that modifies the database ?
<<<<<<<<
Yes, but Access s "IIF", of the same use, evaluates all three, and the documentation explicitly says so. MySQL s, that I have seen, says neither. Assuming the worst is safer, and then one uses CASE ..., but if not, ....
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/mysql?unsub=gcdmg-mysql-2@m.gmane.org
Re: "IF"
am 15.03.2011 16:52:04 von Peter Brawley
> Yes, but Access s "IIF", of the same use, evaluates all three, and the documentation explicitly says so.
Let's be glad we don't depend on Access, then.
PB
-----
On 3/14/2011 7:52 PM, Sándor Halász wrote:
>>>>> 2011/03/14 16:08 +0100, Johan De Meersman>>>>
> I'm afraid I'm not authoritative on this, but it seems to me that it would be very very bad if the third, unused expression were to be evaluated - not only from a performance point of view, but who is to say that that expression is not a user-defined function that modifies the database ?
> <<<<<<<<
> Yes, but Access s "IIF", of the same use, evaluates all three, and the documentation explicitly says so. MySQL s, that I have seen, says neither. Assuming the worst is safer, and then one uses CASE ..., but if not, ....
>
>
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/mysql?unsub=gcdmg-mysql-2@m.gmane.org
Re: "IF"
am 15.03.2011 17:09:18 von prathman rao
SXMgdGhlcmUgYSBmaWVsZCB0byBzYXZlIHN5bWJvbHMgbGlrZSBkZWdyZWUg aW4gbXlzcWwNCi0t
LS0tLU9yaWdpbmFsIE1lc3NhZ2UtLS0tLS0NCkZyb206IFBldGVyIEJyYXds ZXkNClRvOiBteXNx
bEBsaXN0cy5teXNxbC5jb20NClJlcGx5VG86IHBldGVyLmJyYXdsZXlAZWFy dGhsaW5rLm5ldA0K
U3ViamVjdDogUmU6ICJJRiINClNlbnQ6IE1hciAxNSwgMjAxMSA5OjIyIFBN DQoNCj4gIFllcywg
YnV0IEFjY2VzcyBzICJJSUYiLCBvZiB0aGUgc2FtZSB1c2UsIGV2YWx1YXRl cyBhbGwgdGhyZWUs
IGFuZCB0aGUgZG9jdW1lbnRhdGlvbiBleHBsaWNpdGx5IHNheXMgc28uDQoN CkxldCdzIGJlIGds
YWQgd2UgZG9uJ3QgZGVwZW5kIG9uIEFjY2VzcywgdGhlbi4NCg0KUEINCg0K LS0tLS0NCg0KT24g
My8xNC8yMDExIDc6NTIgUE0sIFPhbmRvciBIYWzhc3ogd3JvdGU6DQo+Pj4+ PiAyMDExLzAzLzE0
IDE2OjA4ICswMTAwLCBKb2hhbiBEZSBNZWVyc21hbj4+Pj4NCj4gSSdtIGFm cmFpZCBJJ20gbm90
IGF1dGhvcml0YXRpdmUgb24gdGhpcywgYnV0IGl0IHNlZW1zIHRvIG1lIHRo YXQgaXQgd291bGQg
YmUgdmVyeSB2ZXJ5IGJhZCBpZiB0aGUgdGhpcmQsIHVudXNlZCBleHByZXNz aW9uIHdlcmUgdG8g
YmUgZXZhbHVhdGVkIC0gbm90IG9ubHkgZnJvbSBhIHBlcmZvcm1hbmNlIHBv aW50IG9mIHZpZXcs
IGJ1dCB3aG8gaXMgdG8gc2F5IHRoYXQgdGhhdCBleHByZXNzaW9uIGlzIG5v dCBhIHVzZXItZGVm
aW5lZCBmdW5jdGlvbiB0aGF0IG1vZGlmaWVzIHRoZSBkYXRhYmFzZSA/DQo+ IDw8PDw8PDw8DQo+
IFllcywgYnV0IEFjY2VzcyBzICJJSUYiLCBvZiB0aGUgc2FtZSB1c2UsIGV2 YWx1YXRlcyBhbGwg
dGhyZWUsIGFuZCB0aGUgZG9jdW1lbnRhdGlvbiBleHBsaWNpdGx5IHNheXMg c28uIE15U1FMIHMs
IHRoYXQgSSBoYXZlIHNlZW4sIHNheXMgbmVpdGhlci4gQXNzdW1pbmcgdGhl IHdvcnN0IGlzIHNh
ZmVyLCBhbmQgdGhlbiBvbmUgdXNlcyBDQVNFIC4uLiwgYnV0IGlmIG5vdCwg Li4uLg0KPg0KPg0K
DQotLSANCk15U1FMIEdlbmVyYWwgTWFpbGluZyBMaXN0DQpGb3IgbGlzdCBh cmNoaXZlczogaHR0
cDovL2xpc3RzLm15c3FsLmNvbS9teXNxbA0KVG8gdW5zdWJzY3JpYmU6ICAg IGh0dHA6Ly9saXN0
cy5teXNxbC5jb20vbXlzcWw/dW5zdWI9cHJhdGhpbWFucmFvQHZzbmwubmV0 DQoNCg0KDQpQcmF0
aGltYSBSYW8gIGJsYWNrYmVycnkgbWFpbA==
Re: "IF"
am 15.03.2011 18:29:54 von Johan De Meersman
----- Original Message -----
> From: "Sándor Halász"
>
> Yes, but Access s "IIF", of the same use, evaluates all three, and
> the documentation explicitly says so. MySQL s, that I have seen,
> says neither. Assuming the worst is safer, and then one uses CASE
> ..., but if not, ....
Well, they never have been very good at this whole "common sense" thing, ha=
ve they. Sleep with the dog, get bitten by it's lice.
>
--
Bier met grenadyn
Is als mosterd by den wyn
Sy die't drinkt, is eene kwezel
Hy die't drinkt, is ras een ezel
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/mysql?unsub=3Dgcdmg-mysql-2@m.gmane.o rg
RE: "IF"
am 15.03.2011 18:45:57 von Jerry Schwartz
>-----Original Message-----
>From: Sándor Halász [mailto:hsv@tbbs.net]
>Sent: Monday, March 14, 2011 8:52 PM
>To: Johan De Meersman
>Cc: mysql@lists.mysql.com
>Subject: Re: "IF"
>
>>>>> 2011/03/14 16:08 +0100, Johan De Meersman >>>>
>I'm afraid I'm not authoritative on this, but it seems to me that it would be
>very very bad if the third, unused expression were to be evaluated - not only
>from a performance point of view, but who is to say that that expression is
>not
>a user-defined function that modifies the database ?
><<<<<<<<
>Yes, but Access s "IIF", of the same use, evaluates all three, and the
>documentation explicitly says so. MySQL s, that I have seen, says neither.
>Assuming the worst is safer, and then one uses CASE ..., but if not, ....
>
>
[JS] Also some optimizers (and I don't know if MySQL is that clever) will
figure out which term is the cheapest to evaluate, and will change the order
of evaluation.
Regards,
Jerry Schwartz
Global Information Incorporated
195 Farmington Ave.
Farmington, CT 06032
860.674.8796 / FAX: 860.674.8341
E-mail: jerry@gii.co.jp
Web site: www.the-infoshop.com
>--
>MySQL General Mailing List
>For list archives: http://lists.mysql.com/mysql
>To unsubscribe: http://lists.mysql.com/mysql?unsub=jerry@gii.co.jp
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/mysql?unsub=gcdmg-mysql-2@m.gmane.org