On 09/02/2014 09:40 AM, David G Johnston wrote: > Random thought as I wrote that: how about considering how pl/pgsql > functionality can be generalize so that it is a database API that > another language can call? In that way the server would drive the core > functionality and the language would simply be an interpreter that > enforces its specific notion of acceptable syntax.
That's pretty much what we already have with the SPI and procedural language handler infrastructure. PL/Perl, PL/Python, etc exist because we have this.
What do you see as missing from the current infrastructure? What can't be done that should be able to be done in those languages?
Yet pl/pgsql does not have to use SPI-interface type calls to interact with PostgreSQL at the SQL level...
I don't have an answer to your questions but the one I'm asking is whether a particular language could hide all of the SPI stuff behind some custom syntax so that it in effect looks similar to what pl/pgsql does today? Or, more to the point, does pl/pgsql use the same SPI interface behind the scenes as PL/Perl or does it have its own special interface?