PHP can run java code. It would be easiest, because php doesn't parse php pages, the Zend engine is linked to php to actually parse. Which would make Zend easy to add into Postgresql, (which already runs under apache, which is non-threaded). The only issue is the Zend license.. Of course, this may sound crazy and expensive, but you could throw some apache code in there, and allow any language that works under apache work under postgresql. Call me crazy, but that would allow people to run any parsed language inside of postgresql.