plrust
plrust · Compiles Rust functions to native code as a PostgreSQL procedural language, with optional postgrestd-backed trusted sandboxing.
Overview
| ID | Extension | Package | Version | Category | License | Language |
|---|---|---|---|---|---|---|
| 100797 | plrust | plrust | 1.1 | LANG | PostgreSQL | Rust |
PostgreSQL · 13, 14, 15, 16
| Relationships | |
|---|---|
| Requires | plpgsql |
Usage
Sources:
- Pinned upstream README
- Pinned PostgreSQL configuration reference
- Pinned function guide
- Pinned extension control file
- Pinned crate metadata
plrust is a procedural-language handler that compiles each LANGUAGE plrust function into native machine code using Rust and pgrx. It exposes PostgreSQL data types, SPI queries, set-returning functions, and triggers through Rust APIs.
Required configuration and example
The reviewed release requires preload and a writable compilation work directory:
CREATE FUNCTION invokes the Rust toolchain and may take significant time. The control file’s extension object version is 1.1, matching this catalog, while the pinned crate metadata says 1.2.8. Do not confuse the SQL object version with the crate/package version.
Trust and build-chain boundary
A trusted PL/Rust build is intended only for supported x86_64 or aarch64 Linux configurations using its restricted postgrestd environment and mandatory lints. Other builds are untrusted and do not provide the same containment. Trusted and untrusted compiled functions are different targets and cannot be mixed transparently.
The compiler, linker, work directory, generated shared objects, pgrx bindings, and Rust dependencies become part of the database attack surface. If plrust.allowed_dependencies is unset, the reviewed documentation says all crates are allowed. A user allowed to create functions can consume CPU, disk, memory, and dependency-download resources and may introduce supply-chain code. Use an explicit pinned dependency allowlist, immutable toolchain, restricted writable directory, no unnecessary network access, and tight language CREATE privileges. Do not weaken the required lints; upstream states that doing so removes the expectation of trusted operation.