Dustin Sallings <dustin+postgres(at)spy(dot)net> writes:
> create function box(point) returns box as
> 'select box($1, $1)'
> language 'sql';
> misc=# explain select * from tmp where box(point(-121, 37)) @ b;
> NOTICE: QUERY PLAN:
> Seq Scan on tmp (cost=0.00..2653.01 rows=61 width=92)
You'd better declare the function as 'iscachable'. As is, the planner
doesn't trust it to return a constant.
regards, tom lane