datalink
datalink · SQL/MED DATALINK data type and functions for controlled access to files outside PostgreSQL
Overview
| ID | Extension | Package | Version | Category | License | Language |
|---|---|---|---|---|---|---|
| 100326 | datalink | datalink | 0.5.0 | TYPE | PostgreSQL | C |
PostgreSQL · 10, 11, 12, 13, 14, 15, 16, 17, 18
Usage
Sources:
- Upstream README and proof-of-concept warning
- Extension control file
- SQL installation script
- Background-worker implementation
datalink version 0.5.0 is a proof of concept for the SQL/MED DATALINK type. A value references a URL or a file below a registered base directory and can carry a comment; database-controlled modes attempt token-based access, copy-on-write behavior, and cleanup/recovery of external files.
Minimal construction
The module requires uuid-ossp and uri and must be installed by a superuser. The SQL extension library and worker are separate binaries: preload datalink_bgw, not datalink, and restart PostgreSQL before creating the extension:
Register base directories in pg_catalog.pg_datalink_bases before using local paths. The worker defines datalink.dl_naptime, datalink.dl_token_expiry, datalink.dl_base_directory, datalink.dl_token_path, and datalink.dl_keep_max_copies; review their paths and retention values before startup. The PostgreSQL OS account needs the relevant filesystem permissions.
Upstream explicitly says this is not for production. It creates, copies, renames, symlinks, and deletes server-side files, while a background worker removes token files and some external copies. Defaults and semantics are early-stage and the source has no current compatibility matrix. Test only inside an isolated directory tree with backups and an unprivileged OS account.