Re: query plan ignoring check constraints - Mailing list pgsql-hackers

From John Hansen
Subject Re: query plan ignoring check constraints
Date
Msg-id 5066E5A966339E42AA04BA10BA706AE50A9364@rodrick.geeknet.com.au
Whole thread Raw
In response to query plan ignoring check constraints  (Rohit Gaddi <rohitgaddi@yahoo.co.in>)
Responses Re: query plan ignoring check constraints
List pgsql-hackers
Bruno Wolff III [mailto:bruno@wolff.to] Wrote

> I think the real problem is that check constraints on tables
> aren't used by the optimizer. Given that, what you have below
> is expected.
> There has been talk about that in the past, but I haven't
> heard anything recently about someone considering implenting that.
>
> For your problem consider not using a partial index. It isn't
> going to save anything if it has a constraint matching that
> of the table.


Ahh, I get it now,...
 If a column has a CHECK (col IN (1,2,3)) and a query says .. WHERE col
= 4; then the planner should  know that the query will return 0 rows, right?

... John


pgsql-hackers by date:

Previous
From: Stephen Frost
Date:
Subject: Re: Schedule for 8.1 feature freeze
Next
From: Bruno Wolff III
Date:
Subject: Re: query plan ignoring check constraints