Re: CASE in where statement. BUG ?? - Mailing list pgsql-general

From Csaba Nagy
Subject Re: CASE in where statement. BUG ??
Date
Msg-id 1071829354.1186.5.camel@coppola.ecircle.de
Whole thread Raw
In response to Re: CASE in where statement. BUG ??  (Marek Lewczuk <newsy@lewczuk.com>)
Responses Re: CASE in where statement. BUG ??
List pgsql-general
> Well, I must say that it is wird action... Why to check both elements of
> CASE expression, if we know for sure that only one will be executed ?

Because that's a syntax check, which does NOT evaluate any of the
expressions, only the types of them. Even if it will not be executed
ever, it is still wrong, and it should generate an error, because it
means a mistake on your side which potentially could leave to results
you didn't expect if executed as is.
If it would not generate error in these cases, you would scream when you
by mistake write a wrong query and it doesn't give you the right errors.
Say thanks to the parser that it catches your errors and doesn't let you
do detective work to find out why your queries are not working as you
expect them to work.

Cheers,
Csaba.



pgsql-general by date:

Previous
From: Marek Lewczuk
Date:
Subject: Re: CASE in where statement. BUG ??
Next
From: Marek Lewczuk
Date:
Subject: Re: CASE in where statement. BUG ??