Simplify the PLV8 installation process
Introducing a compact Docker image, based on Debian/Alpine, for PLV8 on PostgreSQL, including the latest versions 16.2 and 15.6:
Supported on:
or
PLV8 for PostgreSQL merges the power of JavaScript and SQL, granting developers flexibility, minimal coding, high performance, and endless possibilities.
Easy installation and integration
Broad architectural
support
Time-saving
efficiency
Continuous support
and updates
First Steps
Run the Docker pull command:
docker pull sibedge/postgres-plv8
Copy
This image is installed in the same manner as the standard Postgres image, with the only difference being the addition of the PLV8 extension.

A script to create the extension should be executed first:
CREATE EXTENSION plv8;
Copy
Then you can perform SQL query:
DO $$
     plv8.elog(NOTICE, plv8.version);
$$ LANGUAGE plv8;
Copy
Afterwards, you will be able to see the version of the installed PLV8 extension.
Image mods
Because of BigInt serialization issue this image comes in two variants:
default build (by default in PLV8 v3.0.0 and higher BigInt numbers are converted into string)
special mod with BigInt serialization support
CREATE TABLE test
(
     id SERIAL PRIMARY KEY NOT NULL,
     comment text
);

INSERT INTO test(comment)
        
VALUES ('abc'), ('def');

CREATE OR REPLACE FUNCTION get_count(table_name text)
     RETURNS jsonb
     LANGUAGE plv8 IMMUTABLE AS
$$
        const sql = `SELECT COUNT(*) AS cnt FROM "${table_name}"`;
        const data = plv8.execute(sql);
        return data[0];
$$;

SELECT * FROM get_count('test');

Copy
Test the differences in work:
Results:
sibedge/postgres-plv8: {"cnt": "2"}
sibedge/postgres-plv8-bigint: {"cnt": 2}
Need to run PLV8
on your physical or cloud server?
Request a custom build tailored to your unique specifications.
Our team is ready to craft the perfect solution for you.
with ♥ from sibedge