pg_tle
pg_tle
pg_tle : Trusted Language Extensions for PostgreSQL
Overview
| ID | Extension | Package | Version | Category | License | Language |
|---|---|---|---|---|---|---|
| 3000 | pg_tle | pg_tle | 1.5.2 | LANG | Apache-2.0 | C |
| Attribute | Has Binary | Has Library | Need Load | Has DDL | Relocatable | Trusted |
|---|---|---|---|---|---|---|
--sLd-- | No | Yes | Yes | Yes | no | no |
| Relationships | |
|---|---|
| Schemas | pgtle |
| See Also | plpgsql plv8 pllua pljava plperl plpython3u plprql plsh |
require bison flex to build
Packages
| Type | Repo | Version | PG Major Compatibility | Package Pattern | Dependencies |
|---|---|---|---|---|---|
| EXT | PIGSTY | 1.5.2 | 18 17 16 15 14 | pg_tle | - |
| RPM | PGDG | 1.5.2 | 18 17 16 15 14 | pg_tle_$v | - |
| DEB | PIGSTY | 1.5.2 | 18 17 16 15 14 | postgresql-$v-pg-tle | - |
| Linux / PG | PG18 | PG17 | PG16 | PG15 | PG14 |
|---|---|---|---|---|---|
el8.x86_64 | PIGSTY 1.5.2 | PIGSTY 1.5.2 | PIGSTY 1.5.2 | PIGSTY 1.5.2 | PIGSTY 1.5.2 |
el8.aarch64 | PIGSTY 1.5.2 | PIGSTY 1.5.2 | PIGSTY 1.5.2 | PIGSTY 1.5.2 | PIGSTY 1.5.2 |
el9.x86_64 | PIGSTY 1.5.2 | PIGSTY 1.5.2 | PIGSTY 1.5.2 | PIGSTY 1.5.2 | PIGSTY 1.5.2 |
el9.aarch64 | PIGSTY 1.5.2 | PIGSTY 1.5.2 | PIGSTY 1.5.2 | PIGSTY 1.5.2 | PIGSTY 1.5.2 |
el10.x86_64 | PIGSTY 1.5.2 | PIGSTY 1.5.2 | PIGSTY 1.5.2 | PIGSTY 1.5.2 | PIGSTY 1.5.2 |
el10.aarch64 | PIGSTY 1.5.2 | PIGSTY 1.5.2 | PIGSTY 1.5.2 | PIGSTY 1.5.2 | PIGSTY 1.5.2 |
d12.x86_64 | PIGSTY 1.5.2 | PIGSTY 1.5.2 | PIGSTY 1.5.2 | PIGSTY 1.5.2 | PIGSTY 1.5.2 |
d12.aarch64 | PIGSTY 1.5.2 | PIGSTY 1.5.2 | PIGSTY 1.5.2 | PIGSTY 1.5.2 | PIGSTY 1.5.2 |
d13.x86_64 | PIGSTY 1.5.2 | PIGSTY 1.5.2 | PIGSTY 1.5.2 | PIGSTY 1.5.2 | PIGSTY 1.5.2 |
d13.aarch64 | PIGSTY 1.5.2 | PIGSTY 1.5.2 | PIGSTY 1.5.2 | PIGSTY 1.5.2 | PIGSTY 1.5.2 |
u22.x86_64 | PIGSTY 1.5.2 | PIGSTY 1.5.2 | PIGSTY 1.5.2 | PIGSTY 1.5.2 | PIGSTY 1.5.2 |
u22.aarch64 | PIGSTY 1.5.2 | PIGSTY 1.5.2 | PIGSTY 1.5.2 | PIGSTY 1.5.2 | PIGSTY 1.5.2 |
u24.x86_64 | PIGSTY 1.5.2 | PIGSTY 1.5.2 | PIGSTY 1.5.2 | PIGSTY 1.5.2 | PIGSTY 1.5.2 |
u24.aarch64 | PIGSTY 1.5.2 | PIGSTY 1.5.2 | PIGSTY 1.5.2 | PIGSTY 1.5.2 | PIGSTY 1.5.2 |
Source
pig build pkg pg_tle; # build rpm/debInstall
Make sure PGDG and PIGSTY repo available:
pig repo add pgsql -u # add both repo and update cacheInstall this extension with pig:
pig install pg_tle; # install via package name, for the active PG version
pig install pg_tle -v 18; # install for PG 18
pig install pg_tle -v 17; # install for PG 17
pig install pg_tle -v 16; # install for PG 16
pig install pg_tle -v 15; # install for PG 15
pig install pg_tle -v 14; # install for PG 14Config this extension to shared_preload_libraries:
shared_preload_libraries = 'pg_tle';Create this extension with:
CREATE EXTENSION pg_tle;Usage
pg_tle lets you create and manage PostgreSQL extensions using trusted languages (SQL, PL/pgSQL, PL/v8, PL/Perl) without requiring filesystem access or server restarts.
Add pg_tle to shared_preload_libraries in postgresql.conf:
shared_preload_libraries = 'pg_tle'Install a TLE Extension
SELECT pgtle.install_extension(
'my_extension', -- extension name
'1.0', -- version
'My custom extension', -- description
$_pgtle_$
CREATE FUNCTION my_func() RETURNS text AS $$
SELECT 'hello from my_extension';
$$ LANGUAGE SQL;
$_pgtle_$
);Manage Extension Versions
-- Add an upgrade path
SELECT pgtle.install_update_path(
'my_extension', -- extension name
'1.0', -- from version
'1.1', -- to version
$_pgtle_$
CREATE OR REPLACE FUNCTION my_func() RETURNS text AS $$
SELECT 'hello from my_extension v1.1';
$$ LANGUAGE SQL;
$_pgtle_$
);
-- Set default version
SELECT pgtle.set_default_version('my_extension', '1.1');Use the TLE Extension
CREATE EXTENSION my_extension;
SELECT my_func(); -- 'hello from my_extension'
ALTER EXTENSION my_extension UPDATE TO '1.1';Remove a TLE Extension
DROP EXTENSION my_extension;
SELECT pgtle.uninstall_extension('my_extension');Hooks and Features
Register custom hooks (e.g., password check hooks):
SELECT pgtle.register_feature('my_password_check', 'passcheck');
SELECT pgtle.unregister_feature('my_password_check', 'passcheck');Key Functions
| Function | Description |
|---|---|
pgtle.install_extension() | Install a new TLE extension |
pgtle.install_update_path() | Add an upgrade path between versions |
pgtle.set_default_version() | Set the default version for an extension |
pgtle.uninstall_extension() | Remove a TLE extension |
pgtle.register_feature() | Register a feature hook |
pgtle.unregister_feature() | Unregister a feature hook |
pgtle.available_extensions() | List available TLE extensions |
pgtle.available_extension_versions() | List available versions |
Last updated on