Skip to content

Latest commit

 

History

History
26 lines (18 loc) · 774 Bytes

README.md

File metadata and controls

26 lines (18 loc) · 774 Bytes

Prolog language for PostgreSQL

This is a PostgreSQL extension that allows writing stored procedures in Prolog.

This embeds Scryer Prolog into a PostgreSQL extension.

Proof of concept! Not ready for any actual use.

Running

You'll need pgrx installed on your system. To install pgrx you can use cargo:

cargo install --locked cargo-pgrx
cargo pgrx init

After that, run with cargo pgrx run.

Then you can create the extension and language:

CREATE EXTENSION pgprolog;
CREATE LANGUAGE plprolog HANDLER plprolog_call_handler;
CREATE FUNCTION myfunc(a TEXT) RETURNS TEXT AS 'parent(alice,bob). handle(In,Out) :- parent(In,Out).' LANGUAGE plprolog;
SELECT myfunc('alice');