We are getting to the final stage of the first stable release of PL/v8. This should be a good release with a lot of improvement such like
- Subtransaction support
- Better name space of built-in functions
- OO style cursor, prepared plan
- Start-up procedure with GUC
- Separate context in user switch
- A series of bug fixes.
And these days I'm getting increasing number of interests and feedback via email, SNS, plv8 project page. Upcoming PGCon will at least have two talks that may cover the usage of PL/v8.
=# CREATE OR REPLACE FUNCTION public.fibonacci(n integer) RETURNS integer LANGUAGE plcoffee IMMUTABLE STRICT AS $function$ fibonacci = (x)-> return 0 if x == 0 return 1 if x == 1 return fibonacci(x-1) + fibonacci(x-2) return fibonacci n $function$; CREATE FUNCTION =# select fibonacci(10); fibonacci ----------- 55 (1 row)
As I noted above, this is only a source transformation, so the engine is still v8, and the runtime environment and other stuff are shared with plv8. Of course it can reference plv8 function via find_function(). The plcoffee EXTENSION is separate and by default it's off. If you are interested in it, clone the latest source and say
make ENABLE_COFFEE=1 install
It works and it attracts more interest from the people around some area. However, it seems it is a little controversial to use CoffeeScript (of course not in the database usage context, but in the web browser and server context) that the source transformation is quite difficult to debug since the problems like run time error emitted by the JS engine is far from the actual script source, which is so annoying. And since I embed the compiler JS source file as a object file symbol, the size of plv8 shared object gets from around 200k byte to 600k byte. Thus, for now I leave it as an "experimental" feature and want to see if it gets popular or not. Please let us know if you like or dislike it.