Re: optimizing impossible matches - Mailing list pgsql-hackers

From Merlin Moncure
Subject Re: optimizing impossible matches
Date
Msg-id 6EE64EF3AB31D5448D0007DD34EEB34101AD87@Herge.rcsinc.local
Whole thread Raw
In response to optimizing impossible matches  ("Merlin Moncure" <merlin.moncure@rcsonline.com>)
List pgsql-hackers
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


pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: question about char/wchar/mb utils
Next
From: Josh Berkus
Date:
Subject: Re: [DEFAULT] Daily digest v1.4318 (23 messages)