Re: [Info-ingres] case statement in where clause
- From: "Roy Hann" <specially@xxxxxxxxxxxxxxxxxxxxx>
- Date: Wed, 31 Aug 2005 15:38:36 +0100
"Gareth Williams" <Gareth.Williams@xxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:mailman.1125496441.19571.info-ingres@xxxxxxxxxxxxxxxxxx
> Ingres SPARC SOLARIS Version II 2.6/0305 (su9.us5/00)
> Anyone ever tried putting a case statement into a where clause
> e.g.
Yes.
> s.date_of_arrival = case when w.start_date = ' ' then
> null else W.episode_start_date end
>
> This managed to crash our production server and we managed to recreate the
> error on our development server (same version).
>
> My questions are...
>
> Is this a valid clause?
The syntax might be, but the intention isn't. You can't test for equality
to null. Null is not a value it is the absence of value. SQL doesn't allow
WHERE col = NULL.
> If it is... then should I log it as a bug?
Anything that crashes a server is a bug.
> If it isn't a valid syntax... then is it a bug anyway as it should have
been
> stopped by the query syntax checking?
That's a good question, because it would mean there are two types of CASE
expression. Those that can evaluate to null and those that can't. Those
that can shouldn't be allowed on the right of a comparison operator. The
lookahead while parsing that would be way over the horizon...!
(Yep, SQL sucks alright. And so do nulls.)
Roy Hann (rhann at rationalcommerce dot com)
Rational Commerce Ltd.
www.rationalcommerce.com
"Ingres development, tuning, and training experts"
.
- Follow-Ups:
- References:
- [Info-ingres] case statement in where clause
- From: Gareth Williams
- [Info-ingres] case statement in where clause
- Prev by Date: Re: [Info-ingres] case statement in where clause
- Next by Date: [Info-ingres] Tar does not look like a tar archive
- Previous by thread: [Info-ingres] case statement in where clause
- Next by thread: [Info-ingres] Tar does not look like a tar archive
- Index(es):
Relevant Pages
|
|