plluau

Lua as an untrusted procedural language

Overview

PackageVersionCategoryLicenseLanguage
pllua2.0.12LANGMITC
IDExtensionBinLibLoadCreateTrustRelocSchema
3020plluaNoYesNoYesNoNopg_catalog
3021hstore_plluaNoYesNoYesNoYes-
3030plluauNoYesNoYesNoNopg_catalog
3031hstore_plluauNoYesNoYesNoYespg_catalog
Relatedplperlu plpgsql plpython3u plv8 pljava pltclu
Depended Byhstore_plluau

missing pg12-15 on el.aarch64

Version

TypeRepoVersionPG VerPackageDeps
EXTPGDG2.0.121817161514pllua-
RPMPGDG2.0.121817161514pllua_$v-
DEBPGDG2.0.121817161514postgresql-$v-pllua-
OS / PGPG18PG17PG16PG15PG14
el8.x86_64PGDG MISSPGDG 2.0.12PGDG 2.0.12PGDG 2.0.11PGDG 2.0.11
el8.aarch64PGDG MISSPGDG 2.0.12PGDG 2.0.12PGDG MISSPGDG MISS
el9.x86_64PGDG MISSPGDG 2.0.12PGDG 2.0.12PGDG 2.0.11PGDG 2.0.11
el9.aarch64PGDG MISSPGDG 2.0.12PGDG 2.0.12PGDG MISSPGDG MISS
el10.x86_64PGDG MISSPGDG 2.0.12PGDG 2.0.12PGDG 2.0.12PGDG 2.0.12
el10.aarch64PGDG MISSPGDG 2.0.12PGDG 2.0.12PGDG 2.0.12PGDG 2.0.12
d12.x86_64PGDG 2.0.12PGDG 2.0.12PGDG 2.0.12PGDG 2.0.12PGDG 2.0.12
d12.aarch64PGDG 2.0.12PGDG 2.0.12PGDG 2.0.12PGDG 2.0.12PGDG 2.0.12
d13.x86_64PGDG 2.0.12PGDG 2.0.12PGDG 2.0.12PGDG 2.0.12PGDG 2.0.12
d13.aarch64PGDG 2.0.12PGDG 2.0.12PGDG 2.0.12PGDG 2.0.12PGDG 2.0.12
u22.x86_64PGDG 2.0.12PGDG 2.0.12PGDG 2.0.12PGDG 2.0.12PGDG 2.0.12
u22.aarch64PGDG 2.0.12PGDG 2.0.12PGDG 2.0.12PGDG 2.0.12PGDG 2.0.12
u24.x86_64PGDG 2.0.12PGDG 2.0.12PGDG 2.0.12PGDG 2.0.12PGDG 2.0.12
u24.aarch64PGDG 2.0.12PGDG 2.0.12PGDG 2.0.12PGDG 2.0.12PGDG 2.0.12

Install

You can install pllua directly. First, make sure the PGDG repository is added and enabled:

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

Install the extension using pig or apt/yum/dnf:

pig install pllua;          # Install for current active PG version
pig ext install -y pllua -v 18  # PG 18
pig ext install -y pllua -v 17  # PG 17
pig ext install -y pllua -v 16  # PG 16
pig ext install -y pllua -v 15  # PG 15
pig ext install -y pllua -v 14  # PG 14
dnf install -y pllua_18       # PG 18
dnf install -y pllua_17       # PG 17
dnf install -y pllua_16       # PG 16
dnf install -y pllua_15       # PG 15
dnf install -y pllua_14       # PG 14
apt install -y postgresql-18-pllua   # PG 18
apt install -y postgresql-17-pllua   # PG 17
apt install -y postgresql-16-pllua   # PG 16
apt install -y postgresql-15-pllua   # PG 15
apt install -y postgresql-14-pllua   # PG 14

Create Extension:

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)

Featurepllua (trusted)plluau (untrusted)
File I/ORestrictedFull access
Module loadingWhitelisted onlyUnrestricted
OS accessNoYes
Suitable forUser-defined functionsAdmin/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 Modified 2026-03-12: add pg extension catalog (95749bf)