Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/tatut/pgprolog
PostgreSQL Prolog language handler
https://github.com/tatut/pgprolog
Last synced: 3 months ago
JSON representation
PostgreSQL Prolog language handler
- Host: GitHub
- URL: https://github.com/tatut/pgprolog
- Owner: tatut
- License: bsd-3-clause
- Created: 2024-03-30T09:13:13.000Z (10 months ago)
- Default Branch: main
- Last Pushed: 2024-04-02T05:12:30.000Z (10 months ago)
- Last Synced: 2024-10-13T22:52:03.781Z (3 months ago)
- Language: Rust
- Size: 6.84 KB
- Stars: 128
- Watchers: 7
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
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');
```