Not too many releases ago, there were several columns in pg_proc that were intended to support estimation of the runtime cost and number of result rows of set-returning functions. I believe in fact that these were the remains of Joe Hellerstein's thesis on expensive-function evaluation
FYI, Hellerstein's thesis on xfunc optimization is available here:
ftp://ftp.cs.wisc.edu/pub/tech-reports/reports/1996/tr1304.ps.Z
There's also a paper on this subject by Hellerstein that was published in Transactions on Database Systems:
http://www.cs.berkeley.edu/~jmh/miscpapers/todsxfunc.pdf
I haven't had a chance to digest either one yet, but it might be worth a look.
-Neil
---------------------------(end of broadcast)--------------------------- TIP 9: the planner will ignore your desire to choose an index scan if your joining column's datatypes do not match