Hi, I just wrote a query that I didn't expect to work but I was pleasantly surprised that it did. It looked something like this: select a.aaa, c.ccc, d.ddd1, d.ddd2 from tbla a, tblb b, tblc c, funcd(c.id) d where a.something = something and b.something = a.something and c.something = b.something How does it know which c.id to use for the function without going all cartesian product on me? Maybe it makes no sense for such a parameterised function to be part of a cartesian product. Actually, that function returns a setof record but only ever a single record. That might be relevant. I was sure I'd done something similar once that (sensibly) didn't work, and I needed a loop to call the function in, but I might be thinking of something in an outer join's "on" clause. Does that make sense? Even more impressed with Postgresql than usual. :-) cheers, raf