Skip to content

Latest commit

 

History

History
59 lines (52 loc) · 1.53 KB

README.md

File metadata and controls

59 lines (52 loc) · 1.53 KB

Kyoto Tycoon Foreign Data Wrapper for PostgreSQL

Thanks to the Blackhole Foreign Data Wrapper for PostgreSQL for providing a good template of how to build FDWs for PostgreSQL.

To Build:

    make
    (sudo) make install

A note about transactional support: This FDW supports Kyoto Tycoon transactions via LUA scripts. Therefore, KT needs to be compiled with LUA support. To do this, run

./configure --enable-lua

when compiling KT.

Furthermore the ktserver has to be started with tranactions.lua loaded:

./ktserver -scr <fdw directory>/transactions.lua

If you want to disable transactions remove -DUSE_TRANSACTIONS from the Makefile in the FDW.

To Test:

make installcheck

Flags

kt_set

insert into <table name> values ('key', 'value', 'kt_set');

Makes insert overwrite existing keys in kyototycoon.

insert into <table name> values ('key', NULL, 'kt_set');

If value == NULL and the 'kt_set' flag is present. The insert acts as a delete.

kt_append

insert into <table name> values ('key', 'value', 'kt_append');

Should append 'value' to any existing value in 'key'

Usage:

CREATE SERVER <server name> FOREIGN DATA WRAPPER kt_fdw OPTIONS
(host '127.0.0.1', port '1978', timeout '-1', reconnect '1000');
(the above options are the defaults)

CREATE USER MAPPING FOR PUBLIC SERVER kt_server;

CREATE FOREIGN TABLE <table name> (key TEXT, value BYTEA, flags TEXT) SERVER <server name>;

Now you can Select, Update, Delete and Insert!