Database Reference
In-Depth Information
PL/CoffeeScript (plcoffee)
This language lets you write functions in CoffeeScript . CoffeeScript is JavaScript
with a more succinct syntax structure that resembles Python. Like Python, it relies
on indentation to impart context but does away with annoying curly braces.
PL/LiveScript (plls)
PL/LiveScript allows you to write functions in LiveScript , a fork of CoffeeScript.
LiveScript is similar to CoffeeScript but with some added syntactic condiments.
This article promotes LiveScript as a superior alternative to CoffeeScript: 10 Rea‐
sons to Switch from CoffeeScript to LiveScript . If anything, LiveScript does have
more Python, F#, and Haskell features than CoffeeScript. If you're looking for a
language with a lighter footprint than PL/Python and that is trusted, you might
want to give LiveScript a try.
PL/CoffeeScript and PL/LiveScript are compiled using the same PL/V8 library. Their
functionality is therefore identical to that of PL/V8. In fact, you can easily convert back
to PL/V8 if they don't suit your taste buds. All three languages are trusted. This means
they can't access OS file systems, but they can be used by nonsuperusers to create func‐
tions.
Example 8-15 has the commands to install the three languages using extensions. For
each database where you'd like to install the support, you must run these lines. You need
not install all three if you choose not to.
Example 8-15. Installing all PL/V8 family of languages
CREATE EXTENSION plv8 ;
CREATE EXTENSION plcoffee ;
CREATE EXTENSION plls ;
The PL/V8 family of languages has many key qualities that make them stand apart from
PL/pgSQL, some of which you'll only find in other high-end procedural languages like
PL/R:
• Generally faster numeric processing than SQL and PL/pgSQL.
• The ability to create window functions. You can't do this using SQL, PL/pgSQL, or
PL/Python. (You can in PL/R and C, though.)
• The ability to create triggers and aggregate functions.
• Support for prepared statements, subtransactions, inner functions, classes, and try-
catch error handling.
• The ability to dynamically generate executable code using an eval function.
• JSON support, allowing for looping over and filtering of JSON objects.
• Access to functions from DO commands.
Search WWH ::




Custom Search