pllua / pllua-deprecated

[DEPRECATED] This repository is no longer maintained. Please follow https://github.com/pllua/pllua
197 stars 16 forks source link

pllu.init - module #66

Open hellower opened 6 years ago

hellower commented 6 years ago

I am very grateful for the pllua module.

Should I insert only the pllua"U" module at pllua.init table? plla"U" module is not allowed in pllua.init table

ex) luarocks install http -- this modue inclde "IO" module. --- untrusted!

sql> insert into pllua.init values('http.request'); sql> CREATE OR REPLACE FUNCTION f_debug() RETURNS integer AS $BODY$ return 1234; $BODY$ LANGUAGE plluau;

ERROR: /opt/PostgreSQL/luarocks//share/lua/5.1/compat53/module.lua:14: attempt to index local 'io' (a nil value) ** Error **

-------------- /opt/PostgreSQL/luarocks//share/lua/5.1/compat53/module.lua ------------- $ cat /opt/PostgreSQL/luarocks//share/lua/5.1/compat53/module.lua|more local _G, _VERSION = _G, _VERSION local lua_version = _VERSION:sub(-3)

local M = _G

if lua_version < "5.3" then

-- cache globals in upvalues local error, ipairs, pairs, pcall, require, select, setmetatable, type = error, ipairs, pairs, pcall, require, select, setmetatable, type local debug, io, math, package, string, table = debug, io, math, package, string, table local io_lines = io.lines <-------------------------- this line !!!! local io_read = io.read local unpack = lua_version == "5.1" and unpack or table.unpack

.........

----------- http module dependencies------------------- https://github.com/daurnimator/lua-http Dependencies cqueues >= 20161214 luaossl >= 20161208 basexx >= 0.2.0 lpeg lpegpatterns >= 0.3 fifo To use gzip compression you need one of: lzlib or lua-zlib If using lua < 5.3 you will need compat-5.3 >= 0.3 ------------------ !!!! If using lua 5.1 you will need luabitop (comes with LuaJIT) or a backported bit32

-- my suggestion ----------------------------

CREATE TABLE pllua.init ( module text ,trusted boolean -- new column ); insert into pllua.init values('http.client, false);

sorry for poor english.