plluau

plluau

pllua : Lua as an untrusted procedural language

Overview

ID Extension Package Version Category License Language
3030
plluau
pllua
2.0.12
LANG
MIT
C
Attribute Has Binary Has Library Need Load Has DDL Relocatable Trusted
--s-d--
No
Yes
No
Yes
no
no
Relationships
Schemas pg_catalog
Need By
hstore_plluau
See Also
plperlu
plpgsql
plpython3u
plv8
pljava
pltclu
Siblings
pllua
hstore_pllua
hstore_plluau

missing pg12-15 on el.aarch64

Packages

Type Repo Version PG Major Compatibility Package Pattern Dependencies
EXT
PGDG
2.0.12
18
17
16
15
14
pllua -
RPM
PGDG
2.0.12
18
17
16
15
14
pllua_$v -
DEB
PGDG
2.0.12
18
17
16
15
14
postgresql-$v-pllua -
Linux / PG PG18 PG17 PG16 PG15 PG14
el8.x86_64
MISS
PGDG 2.0.12
PGDG 2.0.12
PGDG 2.0.11
PGDG 2.0.11
el8.aarch64
MISS
PGDG 2.0.12
PGDG 2.0.12
MISS
MISS
el9.x86_64
MISS
PGDG 2.0.12
PGDG 2.0.12
PGDG 2.0.11
PGDG 2.0.11
el9.aarch64
MISS
PGDG 2.0.12
PGDG 2.0.12
MISS
MISS
el10.x86_64
MISS
PGDG 2.0.12
PGDG 2.0.12
PGDG 2.0.12
PGDG 2.0.12
el10.aarch64
MISS
PGDG 2.0.12
PGDG 2.0.12
PGDG 2.0.12
PGDG 2.0.12
d12.x86_64
PGDG 2.0.12
PGDG 2.0.12
PGDG 2.0.12
PGDG 2.0.12
PGDG 2.0.12
d12.aarch64
PGDG 2.0.12
PGDG 2.0.12
PGDG 2.0.12
PGDG 2.0.12
PGDG 2.0.12
d13.x86_64
PGDG 2.0.12
PGDG 2.0.12
PGDG 2.0.12
PGDG 2.0.12
PGDG 2.0.12
d13.aarch64
PGDG 2.0.12
PGDG 2.0.12
PGDG 2.0.12
PGDG 2.0.12
PGDG 2.0.12
u22.x86_64
PGDG 2.0.12
PGDG 2.0.12
PGDG 2.0.12
PGDG 2.0.12
PGDG 2.0.12
u22.aarch64
PGDG 2.0.12
PGDG 2.0.12
PGDG 2.0.12
PGDG 2.0.12
PGDG 2.0.12
u24.x86_64
PGDG 2.0.12
PGDG 2.0.12
PGDG 2.0.12
PGDG 2.0.12
PGDG 2.0.12
u24.aarch64
PGDG 2.0.12
PGDG 2.0.12
PGDG 2.0.12
PGDG 2.0.12
PGDG 2.0.12

Source

Install

Make sure PGDG repo available:

pig repo add pgdg -u    # add pgdg repo and update cache

Install this extension with pig:

pig install pllua;		# install via package name, for the active PG version
pig install plluau;		# install by extension name, for the current active PG version

pig install plluau -v 18;   # install for PG 18
pig install plluau -v 17;   # install for PG 17
pig install plluau -v 16;   # install for PG 16
pig install plluau -v 15;   # install for PG 15
pig install plluau -v 14;   # install for PG 14

Create this extension with:

CREATE EXTENSION plluau;

Usage

plluau: Lua as an untrusted procedural language

plluau is the untrusted variant of pllua, allowing Lua functions to access the filesystem, load arbitrary modules, and perform operations restricted in the trusted version.

CREATE EXTENSION plluau;

Create Functions

CREATE FUNCTION read_file(path text) RETURNS text LANGUAGE plluau AS $$
  local f = io.open(path, "r")
  if f then
    local content = f:read("*a")
    f:close()
    return content
  end
  return nil
$$;

Differences from pllua (Trusted)

Feature pllua (trusted) plluau (untrusted)
File I/O Restricted Full access
Module loading Whitelisted only Unrestricted
OS access No Yes
Suitable for User-defined functions Admin/superuser functions

Same API as pllua

plluau shares the same SPI interface, trigger support, set-returning functions, and data type handling as pllua. All SPI functions (spi.execute, spi.prepare, spi.rows), coroutine-based set returns, and trigger functions work identically.

CREATE FUNCTION run_command(cmd text) RETURNS text LANGUAGE plluau AS $$
  local handle = io.popen(cmd)
  local result = handle:read("*a")
  handle:close()
  return result
$$;

Initialization

Configure via GUC (superuser only):

SET pllua.on_untrusted_init = 'myvar = {}';

Only superusers can create plluau functions due to the unrestricted access it provides.

Last updated on