plpgsql_wrap
Overview
| Package | Version | Category | License | Language |
|---|---|---|---|---|
plpgsql_wrap | 1.0 | SIM | PostgreSQL | C |
| ID | Extension | Bin | Lib | Load | Create | Trust | Reloc | Schema |
|---|---|---|---|---|---|---|---|---|
| 9210 | plpgsql_wrap | No | Yes | No | Yes | No | No | - |
PGDG RPM and Pigsty DEB package hexacluster/plpgsql_wrap 1.0; control requires plpgsql and superuser=true; links OpenSSL.
Version
| Type | Repo | Version | PG Ver | Package | Deps |
|---|---|---|---|---|---|
| EXT | PGDG | 1.0 | 1817161514 | plpgsql_wrap | plpgsql |
| RPM | PGDG | 1.0 | 1817161514 | plpgsql_wrap_$v | openssl-libs |
| DEB | PIGSTY | 1.0 | 1817161514 | postgresql-$v-plpgsql-wrap | libssl3 |
Build
You can build the RPM / DEB packages for plpgsql_wrap using pig build:
Install
You can install plpgsql_wrap directly. First, make sure the PGDG repository is added and enabled:
Install the extension using pig or apt/yum/dnf:
Create Extension:
Usage
Sources: README, v1.0 release, control file
plpgsql_wrap provides an Oracle WRAP-style procedural language for PostgreSQL. Functions written with LANGUAGE plpgsql_wrap are validated as PL/pgSQL and then stored encrypted in pg_proc.prosrc as PLPGSQLWRAP:1:<hex>.
Install With A Key
Build the extension with a 32-byte AES-256-GCM key:
Back up the key. Wrapped functions can only be unwrapped or restored safely when the correct compiled key is available.
Install the extension in each database that needs the language:
Create Wrapped Functions
Use normal PL/pgSQL syntax with a different language name:
The stored body is opaque:
Dump, Restore, And Unwrap
pg_dump emits the encrypted PLPGSQLWRAP:1: blob. A restore on a server with the same compiled key works normally. A different key leaves the blob stored, but calls fail when the validator/authentication path cannot authenticate it.
Superusers can permanently unwrap a function when they know the key:
Caveats
- Version 1.0 supports PostgreSQL 14-18.
- The control file requires
plpgsqland superuser installation. - This protects casual source inspection and dumps, but the compiled key is a critical secret. Treat package artifacts and build logs accordingly.
- Syntax is validated before encryption, so ordinary PL/pgSQL syntax errors abort
CREATE FUNCTIONbefore encrypted storage is written.
Was this page helpful?
Thanks—your feedback helps us improve this page.
What got in the way? (optional)