-
Notifications
You must be signed in to change notification settings - Fork 1
PostgreSQL procedural
GradedJestRisk edited this page Oct 20, 2024
·
1 revision
Postgresql can natively call:
- pg/plsql
- perl
- python
- Java
- JavaScript
- shell
https://github.com/petere/plsh
Can't access database
Can access database
Start with https://github.com/clkao/docker-postgres-plv8/blob/master/12-2/Dockerfile
docker build -t plv8:12-2 .
Native Documentation
CREATE EXTENSION plv8; DO $$plv8.elog(NOTICE, "Hello, world!"); $$ LANGUAGE plv8;
https://plv8.github.io/#database-access-via-spi
npm install plv8-git psql -c " create extension if not exists plv8; select plv8_version(); " psql -f node_modules/plv8-git/queries/create-git-functions.sql
create table test_table( id int, text text, git json ); create trigger test_table_git_track_trigger before insert or update on test_table for each row execute procedure git_track(); insert into test_table(id, text) values(1, 'item 1 old content'); update test_table set text = 'item 1 new content' where id = 1; select git_log(git) from test_table where id = 1