Andriy I Pilipenko <bamby(at)marka(dot)net(dot)ua> writes:
> create table a (a int)
> create table b (b int)
> create function f() returns int as '
> 	select a 
>           from a 
>          where a = (select max(b) from b)
> ' language 'sql' 
> with (iscachable)
> select f()
>   ERROR:  replace_vars_with_subplan_refs: variable not in subplan target list
Oh my, that's interesting :-( --- especially that it doesn't happen
without iscachable.  Will look into it.  Thanks for the report.
			regards, tom lane