Tom Lane wrote:
> The optimizer has no knowledge of specific operators except what it
> finds in the system catalogs.  It has no way in general to determine
> that a comparison involving nonconstant values must always fail.
> Even if we could do it, I am dubious that it would be worth expending
> the cycles on every query to determine whether the situation holds.
> AFAICS those would be wasted cycles on the huge majority of queries.

Ok, fair enough.  And queries that did have this issue could be easily
rewritten...

Still, there is something that doesn't site quite right with me...my
problems is with SQL really, not Postgres.  For example, the server
forbids 'abcd'::char(3) but allows 'abcd' > char(3) because the operator
is not bound to the specific type, but to the general type and ignores
type constraints.  In other words, SQL implicitly allows comparison
between objects of different domains if the domains differ only by
constraint (including size).

Anyways, thanks for taking the time to answer.
Merlin

Wed, 10 Mar 2004 12:16:06 -0500
"Merlin Moncure" <merlin.moncure@rcsonline.com>
Re: optimizing impossible matches 