Re: [SQL] FW: view derived from view doesn't use indexes

2012-07-26 Thread Tom Lane
Russell Keane writes: > Using PG 9.0 and given the following definitions: > CREATE OR REPLACE FUNCTION status_to_flag(status character) > RETURNS integer AS > $BODY$ > ... > $BODY$ > LANGUAGE plpgsql > CREATE OR REPLACE VIEW test_view1 AS > SELECT status_to_flag(test_table.status) AS flag, > tes

[SQL] FW: view derived from view doesn't use indexes

2012-07-26 Thread Russell Keane
Using PG 9.0 and given the following definitions: CREATE SEQUENCE test_code_id; CREATE TABLE test_table ( status character(1) NOT NULL DEFAULT 'C'::bpchar, code_id integer NOT NULL DEFAULT nextval('test_code_id') ); CREATE INDEX test1 ON test_table USING btree (status, code_id); CREATE OR REPLA