PostGIS installs standard constraints of this kind: CHECK (geometrytype(g) = 'POINT'::text OR g IS NULL)
The constraint is used by constraint_exclusion if using this condition: WHERE g IS NOT NULL AND geometrytype(g) = 'LINESTRING' But it is _NOT_ used if the NOT NULL condition is removed: WHERE geometrytype(g) = 'LINESTRING' As the "geometrytype" is defined as STRICT and IMMUTABLE, there's no way for geometrytype(g) = 'LINESTRING' to hold true, so why is the "IS NOT NULL" condition also needed by the planner ? Andres Freund on IRC suggested that predicate_refuted_by_simple_clause() looks like trying to handle such cases, but if that's the case it seems to fail here. --strk; -- Sent via pgsql-hackers mailing list ([email protected]) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers
