跳转到主要内容

hstore_plluau

Hstore transform for untrusted Lua

pllua : Hstore transform for untrusted Lua

Overview

ID Extension Package Version Category License Language
3031 hstore_plluau pllua 2.0.12 LANG MIT C
Attribute Has Binary Has Library Need Load Has DDL Relocatable Trusted
--s-d-r No Yes No Yes yes no
Relationships
Schemas pg_catalog
Requires hstore plluau
See Also hstore hstore_plpython3u hstore_plperl hstore_plperlu
Siblings pllua hstore_pllua plluau

Packages

Type Repo Version PG Major Compatibility Package Pattern Dependencies
EXT MIXED 2.0.12 18 17 16 15 14 pllua hstore, plluau
RPM PIGSTY 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 PIGSTY 2.0.12 PIGSTY 2.0.12 PIGSTY 2.0.12 PIGSTY 2.0.12 PIGSTY 2.0.12
el8.aarch64 PIGSTY 2.0.12 PIGSTY 2.0.12 PIGSTY 2.0.12 PIGSTY 2.0.12 PIGSTY 2.0.12
el9.x86_64 PIGSTY 2.0.12 PIGSTY 2.0.12 PIGSTY 2.0.12 PIGSTY 2.0.12 PIGSTY 2.0.12
el9.aarch64 PIGSTY 2.0.12 PIGSTY 2.0.12 PIGSTY 2.0.12 PIGSTY 2.0.12 PIGSTY 2.0.12
el10.x86_64 PIGSTY 2.0.12 PIGSTY 2.0.12 PIGSTY 2.0.12 PIGSTY 2.0.12 PIGSTY 2.0.12
el10.aarch64 PIGSTY 2.0.12 PIGSTY 2.0.12 PIGSTY 2.0.12 PIGSTY 2.0.12 PIGSTY 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
u26.x86_64 PGDG 2.0.12 PGDG 2.0.12 PGDG 2.0.12 PGDG 2.0.12 PGDG 2.0.12
u26.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 and PIGSTY repo available:

pig repo add pgsql -u   # add both repo and update cache

Install this extension with pig:

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

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

Create this extension with:

CREATE EXTENSION hstore_plluau CASCADE; -- requires hstore, plluau

Usage

hstore_plluau: hstore transform for PL/Lua untrusted

The hstore_plluau extension provides a transform that allows hstore values to be passed directly to and from untrusted PL/Lua (plluau) functions as native Lua tables.

CREATE EXTENSION hstore;
CREATE EXTENSION plluau;
CREATE EXTENSION hstore_plluau;

Using hstore in plluau

With the transform installed, hstore arguments are automatically converted to Lua tables:

CREATE FUNCTION process_hstore(h hstore) RETURNS hstore LANGUAGE plluau AS $$
  -- h is a Lua table with string keys and string values
  h["processed"] = "true"
  -- Can also do unrestricted operations (file I/O, etc.)
  return h
$$;

SELECT process_hstore('key1 => "val1", key2 => "val2"'::hstore);

This is the untrusted counterpart to hstore_pllua. The behavior is identical – hstore values become Lua tables and vice versa – but functions run in the unrestricted plluau environment.