Joe <dev@freedomcircle.net> writes:
> George didn't provide the inside of his view, but it's
> possible that my earlier example could be rephrased as follows:
> create view v_foo as select * from tab where x < 5;
> select * from v_foo where x = 10;
So try it:
regression=# create table tab (x int);
CREATE TABLE
regression=# create view v_foo as select * from tab where x < 5;
CREATE VIEW
regression=# explain select * from v_foo where x = 10; QUERY PLAN
----------------------------------------------------Seq Scan on tab (cost=0.00..46.00 rows=4 width=4) Filter: ((x <
5)AND (x = 10))
(2 rows)
regression=# set constraint_exclusion to 1;
SET
regression=# explain select * from v_foo where x = 10; QUERY PLAN
------------------------------------------Result (cost=0.00..0.01 rows=1 width=0) One-Time Filter: false
(2 rows)
(This is with HEAD, but I think 8.2 can do it too.)
regards, tom lane