In-memory qualifier evaluation bug
In-memory qualifier evaluation bug
- Subject: In-memory qualifier evaluation bug
- From: Sacha Michel Mallais <email@hidden>
- Date: Thu, 31 Jul 2008 13:12:57 -0700
Hi all, I've run into an in-memory qualifier evaluation bug and I
thought I'd post it here to notify the community and also in case
anyone has any comments or insights (I'll also submit a bug report to
Apple).
In a nutshell, the problem is that WO fails to correctly evaluate
null values in 3-value logic. For a trivial example, in-memory
evaluation treats "myColumn != 'some value'" as true when myColumn is
null, when it should evaluate to "null". 3-value logic dictates that
comparing a null value to a non-null value results in "null" (unless
using the "is null" or is not null" operators). Unsurprisingly, if
you evaluate a qualifier at the database, it works correctly
(depending on the database, I guess ;-).
Chuck took a look at the comparison support stuff in WO, in hopes
that we could patch it, but it looks like that stuff only returns a
primitive boolean, which means true or false, and which cannot hope
to provide the full functionality of 3-value logic. Specifically, it
cannot handle a qualifier like "NOT (myColumn != 'some value')",
which should also evaluate to "null" if myColumn is null -- however
note that if our comparison function can only return true or false,
the "NOT" qualifier will simply invert the true/false result of
myColumn != 'some value', which works some of the time, but not
always...
At this point, it looks like I'll need to rewrite my queries to
include a test for "is not null" (e.g. (myColumn IS NOT NULL AND
myColumn != 'some value'))... I think that will correctly work around
the bug.
I've attached a minimal test case, in case anyone wants to see it in
action. It is an Eclipse project, inside of which is a script to
create the necessary table and data.
sacha
--
Sacha Michel Mallais Senior Developer / President
Global Village Consulting Inc. http://www.global-village.net/
PGP Key ID: 7D757B65 AIM: smallais
The chance of being shot in the foot is directly correlated
to the number of ways to be shot in the foot.
Attachment:
InMemoryNullTest.zip
Description: Zip archive
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden