plv8
PL/JavaScript (v8) trusted procedural language
	Module:
Categories:
Overview
PIGSTY 3rd Party Extension:  plv8 : PL/JavaScript (v8) trusted procedural language
Information
- Extension ID: 3010
- Extension Name: plv8
- Package Name: plv8
- Category: LANG
- License: PostgreSQL
- Website: https://github.com/plv8/plv8
- Language: C++
- Extra Tags: N/A
- Comment: N/A
Metadata
- Latest Version: 3.2.3
- Postgres Support: 17,16,15,14,13
- Need Load: Shared library do not need explicit loading
- Need DDL:  Need CREATE EXTENSIONDDL
- Relocatable: Can be installed into other schemas
- Trusted: Untrusted, Require Superuser to Create
- Schemas: pg_catalog
- Requires: N/A
RPM / DEB
- RPM Repo: PIGSTY
- RPM Name: plv8_$v*
- RPM Ver : 3.2.3
- RPM Deps: N/A
- DEB Repo: PIGSTY
- DEB Name: postgresql-$v-plv8
- DEB Ver : 3.2.3
- DEB Deps: N/A
Availability
| OS | Arch | PG17 | PG16 | PG15 | PG14 | PG13 | 
|---|---|---|---|---|---|---|
| el8 | x86_64 | plv8_17PIGSTY 3.2.3 | plv8_16PIGSTY 3.2.3 | plv8_15PIGSTY 3.2.3 | plv8_14PIGSTY 3.2.3 | plv8_13PIGSTY 3.2.3 | 
| el8 | aarch64 | plv8_17PIGSTY 3.2.3 | plv8_16PIGSTY 3.2.3 | plv8_15PIGSTY 3.2.3 | plv8_14PIGSTY 3.2.3 | plv8_13PIGSTY 3.2.3 | 
| el9 | x86_64 | plv8_17PIGSTY 3.2.3 | plv8_16PIGSTY 3.2.3 | plv8_15PIGSTY 3.2.3 | plv8_14PIGSTY 3.2.3 | plv8_13PIGSTY 3.2.3 | 
| el9 | aarch64 | plv8_17PIGSTY 3.2.3 | plv8_16PIGSTY 3.2.3 | plv8_15PIGSTY 3.2.3 | plv8_14PIGSTY 3.2.3 | plv8_13PIGSTY 3.2.3 | 
| d12 | x86_64 | postgresql-17-plv8PIGSTY 3.2.3 | postgresql-16-plv8PIGSTY 3.2.3 | postgresql-15-plv8PIGSTY 3.2.3 | postgresql-14-plv8PIGSTY 3.2.3 | postgresql-13-plv8PIGSTY 3.2.3 | 
| d12 | aarch64 | postgresql-17-plv8PIGSTY 3.2.3 | postgresql-16-plv8PIGSTY 3.2.3 | postgresql-15-plv8PIGSTY 3.2.3 | postgresql-14-plv8PIGSTY 3.2.3 | postgresql-13-plv8PIGSTY 3.2.3 | 
| u22 | x86_64 | postgresql-17-plv8PIGSTY 3.2.3 | postgresql-16-plv8PIGSTY 3.2.3 | postgresql-15-plv8PIGSTY 3.2.3 | postgresql-14-plv8PIGSTY 3.2.3 | postgresql-13-plv8PIGSTY 3.2.3 | 
| u22 | aarch64 | postgresql-17-plv8PIGSTY 3.2.3 | postgresql-16-plv8PIGSTY 3.2.3 | postgresql-15-plv8PIGSTY 3.2.3 | postgresql-14-plv8PIGSTY 3.2.3 | postgresql-13-plv8PIGSTY 3.2.3 | 
| u24 | x86_64 | postgresql-17-plv8PIGSTY 3.2.3 | postgresql-16-plv8PIGSTY 3.2.3 | postgresql-15-plv8PIGSTY 3.2.3 | postgresql-14-plv8PIGSTY 3.2.3 | postgresql-13-plv8PIGSTY 3.2.3 | 
| u24 | aarch64 | postgresql-17-plv8PIGSTY 3.2.3 | postgresql-16-plv8PIGSTY 3.2.3 | postgresql-15-plv8PIGSTY 3.2.3 | postgresql-14-plv8PIGSTY 3.2.3 | postgresql-13-plv8PIGSTY 3.2.3 | 
Installation
Install plv8 via the pig CLI tool:
pig ext install plv8
Install plv8 via Pigsty playbook:
./pgsql.yml -t pg_extension -e '{"pg_extensions": ["plv8"]}' # -l <cls>
Install plv8 RPM from YUM repo directly:
dnf install plv8_17*;
dnf install plv8_16*;
dnf install plv8_15*;
dnf install plv8_14*;
dnf install plv8_13*;
Install plv8 DEB from APT repo directly:
apt install postgresql-17-plv8;
apt install postgresql-16-plv8;
apt install postgresql-15-plv8;
apt install postgresql-14-plv8;
apt install postgresql-13-plv8;
Create plv8 extension on PostgreSQL cluster:
CREATE EXTENSION plv8;
Usage
CREATE EXTENSION plv8;
SELECT plv8_version();
SELECT plv8_info();
DO $$ plv8.elog(NOTICE, plv8.version); $$ LANGUAGE plv8;
Example:
CREATE FUNCTION plv8_test(keys TEXT[], vals TEXT[]) RETURNS JSON AS $$
    var o = {};
    for(var i=0; i<keys.length; i++){
        o[keys[i]] = vals[i];
    }
    return o;
$$ LANGUAGE plv8 IMMUTABLE STRICT;
SELECT plv8_test(ARRAY['name', 'age'], ARRAY['Tom', '29']);
Feedback
Was this page helpful?
Glad to hear it! Please tell us how we can improve.
Sorry to hear that. Please tell us how we can improve.