summaryrefslogtreecommitdiffstats
path: root/tests/pllua
diff options
context:
space:
mode:
Diffstat (limited to 'tests/pllua')
-rw-r--r--tests/pllua30
1 files changed, 30 insertions, 0 deletions
diff --git a/tests/pllua b/tests/pllua
new file mode 100644
index 0000000..2821122
--- /dev/null
+++ b/tests/pllua
@@ -0,0 +1,30 @@
+#!/bin/sh
+
+# this test is due to:
+# http://redmine.alpinelinux.org/issues/503
+
+# pllua test is from:
+# http://pllua.projects.postgresql.org/
+
+apk_add postgresql pllua
+/etc/init.d/postgresql start
+
+# create db and pllua language
+psql -U postgres -c 'create database aptstest'
+psql -U postgres -f /usr/share/postgresql/contrib/pllua.sql aptstest
+
+# create function
+psql -U postgres -d aptstest -c '
+CREATE FUNCTION hello(name text) RETURNS text AS $$
+ return string.format("hello:%s", name)
+$$ LANGUAGE pllua;
+'
+
+# test that lua function works
+psql -U postgres -d aptstest -c "SELECT hello('lua');" | grep 'hello:lua'
+
+# cleanup
+psql -U postgres -c 'drop database aptstest'
+/etc/init.d/postgresql stop
+apk_del pllua postgresql
+