When looking at official PostgreSQL documentation, to install PL/Python of PLV8 (JavaScript V8) procedural languages to PostgreSQL 9.3, it is sufficient to do:
postgres@host:~$ createlang plv8 dbname
postgres@host:~$ createlang plpythonu dbname
from a terminal, logged on as a user known to PostgreSQL.
But, when tried this after a fresh install of PostgreSQL 9.3, I got something like:
createlang: language installation failed: ERROR: could not open extension control file "/usr/share/postgresql/9.3/extension/plpython2u.control": No such file or directory
Well, if you are confused just like me, you need first to install Ubuntu packages for the two procedural language, and then to enjoy the inspiring moments of using these powerful programming languages to write your stored procedures.
Something like this:
user@host:~$ sudo apt-get install postgresql-plpython-9.3
for Python 2, and
user@host:~$ sudo apt-get install postgresql-9.3-plv8
for JavaScript V8.
After this, you can issue the documentation instructed:
postgres@host:~$ createlang plv8 dbname
postgres@host:~$ createlang plpythonu dbname
Other Ubuntu packages containing languages that might be interesting:
- postgresql-plpython3-9.3 - for using Python3 as procedural language with PostgreSQL (if you dare!).
- postgresql-plperl-9.3 - to use Perl as a procedural language inside PostgreSQL stored procedures.
- postgresql-pltcl-9.3 - Tcl procedural language.