pg_typescript
pg_typescript · pg_typescript: TypeScript/JavaScript procedural language for PostgreSQL
Overview
| ID | Extension | Package | Version | Category | License | Language |
|---|---|---|---|---|---|---|
| 101101 | pg_typescript | pg_typescript | 0.1.0 | LANG | MIT | Rust |
PostgreSQL · 14, 15, 16, 17, 18
Usage
Sources:
pg_typescript version 0.1.0 is an alpha procedural language that runs TypeScript with Deno/V8 in PostgreSQL 16–18. It supports ordinary functions, remote or npm imports, and database access through _pg.execute. A runtime is created per backend; adding the library to shared_preload_libraries is optional prewarming rather than a requirement.
Create a dependency-free function
The control file marks the language trusted, but extension installation is superuser-only and function owners can request capabilities through user-set typescript.allow_* settings. Imports default to allowed, while _pg.execute defaults to denied until explicitly requested; however, the superuser typescript.max_* ceilings are the real upper boundary, and their upstream defaults are effectively uncapped. Set restrictive maximum import, network, file, environment, process, FFI, system, and database-execution policies before granting language use. Remote modules are fetched when functions are created and cached locally, so pin and audit every dependency. Treat untrusted TypeScript as database code, and test memory, timeout, backend-crash, cold-start, and supply-chain behavior before production use.