Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/tatut/pgprolog

PostgreSQL Prolog language handler
https://github.com/tatut/pgprolog

Last synced: about 1 month ago
JSON representation

PostgreSQL Prolog language handler

Awesome Lists containing this project

README

        

# Prolog language for PostgreSQL

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

This embeds [Scryer Prolog](https://www.scryer.pl) into a PostgreSQL extension.

**Proof of concept!** Not ready for any actual use.

## Running

You'll need [pgrx](https://github.com/pgcentralfoundation/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');
```