[postgis-devel] ST_Equals, immutable strict
strk
strk at keybit.net
Wed Sep 1 02:06:52 PDT 2010
On Tue, Aug 31, 2010 at 07:15:38PM -0400, Paragon Corporation wrote:
> So if it concludes the content of your function is NON-STRICT, but you mark
> it as STRICT -- it can't blindly inline it. Since the inlined version could
> return a different answer from your intended.
Right, so the problem lies in "concluding the content of your function
is NON-STRICT", which fails in this case.
Anarazel found that postgresql considers AND and OR inherently
non-strict [1], And that this is due to :
SELECT NULL AND false; -- giving false
But such construct really is only non-strict if any operand
in the AND is non-strict or is not using the argument.
In our case we have:
SELECT $1 && $2 AND _ST_Intersects($1,$2);
^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^
They are both strict (the function is, the function associated
with the operator is), so for a NULL $1 or $2 the body would
resolve in:
NULL AND NULL
I think either the planner should do a better job OR (better)
let the function definer signal inlinability with another
switch (INLINE?)
[1] http://trac.osgeo.org/postgis/ticket/536
--strk;
() Free GIS & Flash consultant/developer
/\ http://strk.keybit.net/services.html
More information about the postgis-devel
mailing list