plv8

PL/JavaScript (v8) trusted procedural language

Overview

PIGSTY 3rd Party Extension: plv8 : PL/JavaScript (v8) trusted procedural language

Information

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 EXTENSION DDL
  • 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

Packages

OS Arch PG17 PG16 PG15 PG14 PG13
el8 x86_64 plv8_17
PIGSTY 3.2.3
plv8_16
PIGSTY 3.2.3
plv8_15
PIGSTY 3.2.3
plv8_14
PIGSTY 3.2.3
plv8_13
PIGSTY 3.2.3
el8 aarch64 plv8_17
PIGSTY 3.2.3
plv8_16
PIGSTY 3.2.3
plv8_15
PIGSTY 3.2.3
plv8_14
PIGSTY 3.2.3
plv8_13
PIGSTY 3.2.3
el9 x86_64 plv8_17
PIGSTY 3.2.3
plv8_16
PIGSTY 3.2.3
plv8_15
PIGSTY 3.2.3
plv8_14
PIGSTY 3.2.3
plv8_13
PIGSTY 3.2.3
el9 aarch64 plv8_17
PIGSTY 3.2.3
plv8_16
PIGSTY 3.2.3
plv8_15
PIGSTY 3.2.3
plv8_14
PIGSTY 3.2.3
plv8_13
PIGSTY 3.2.3
d12 x86_64 postgresql-17-plv8
PIGSTY 3.2.3
postgresql-16-plv8
PIGSTY 3.2.3
postgresql-15-plv8
PIGSTY 3.2.3
postgresql-14-plv8
PIGSTY 3.2.3
postgresql-13-plv8
PIGSTY 3.2.3
d12 aarch64 postgresql-17-plv8
PIGSTY 3.2.3
postgresql-16-plv8
PIGSTY 3.2.3
postgresql-15-plv8
PIGSTY 3.2.3
postgresql-14-plv8
PIGSTY 3.2.3
postgresql-13-plv8
PIGSTY 3.2.3
u22 x86_64 postgresql-17-plv8
PIGSTY 3.2.3
postgresql-16-plv8
PIGSTY 3.2.3
postgresql-15-plv8
PIGSTY 3.2.3
postgresql-14-plv8
PIGSTY 3.2.3
postgresql-13-plv8
PIGSTY 3.2.3
u22 aarch64 postgresql-17-plv8
PIGSTY 3.2.3
postgresql-16-plv8
PIGSTY 3.2.3
postgresql-15-plv8
PIGSTY 3.2.3
postgresql-14-plv8
PIGSTY 3.2.3
postgresql-13-plv8
PIGSTY 3.2.3
u24 x86_64 postgresql-17-plv8
PIGSTY 3.2.3
postgresql-16-plv8
PIGSTY 3.2.3
postgresql-15-plv8
PIGSTY 3.2.3
postgresql-14-plv8
PIGSTY 3.2.3
postgresql-13-plv8
PIGSTY 3.2.3
u24 aarch64 postgresql-17-plv8
PIGSTY 3.2.3
postgresql-16-plv8
PIGSTY 3.2.3
postgresql-15-plv8
PIGSTY 3.2.3
postgresql-14-plv8
PIGSTY 3.2.3
postgresql-13-plv8
PIGSTY 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;

Enable 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']);




Last modified 2025-02-17: add extension part (cfa504b)