external_file
Access external server-side files through PostgreSQL functions
Repository
darold/external_file
https://github.com/darold/external_file
Source
external_file-1.2.tar.gz
external_file-1.2.tar.gz
Overview
| Package | Version | Category | License | Language |
|---|---|---|---|---|
external_file | 1.2 | UTIL | PostgreSQL | SQL |
| ID | Extension | Bin | Lib | Load | Create | Trust | Reloc | Schema |
|---|---|---|---|---|---|---|---|---|
| 4285 | external_file | No | No | No | Yes | No | No | external_file |
| Related | fio floatfile file_fdw byteamagic aws_s3 envvar pg_bulkload basic_archive basebackup_to_shell pg_parquet |
|---|
Fixed schema external_file; superuser required.
Version
| Type | Repo | Version | PG Ver | Package | Deps |
|---|---|---|---|---|---|
| EXT | PIGSTY | 1.2 | 1817161514 | external_file | - |
| RPM | PIGSTY | 1.2 | 1817161514 | external_file_$v | - |
| DEB | PIGSTY | 1.2 | 1817161514 | postgresql-$v-external-file | - |
Build
You can build the RPM / DEB packages for external_file using pig build:
Install
You can install external_file directly. First, make sure the PGDG and PIGSTY repositories are added and enabled:
Install the extension using pig or apt/yum/dnf:
Install
pig
dnf
apt
Create Extension:
Usage
Source: README, Release v1.2
external_file stores file locators as (directory, filename) pairs and accesses server-side files through PostgreSQL lo_* helpers rather than direct file reads.
Basic workflow
Core objects
directories: maps an alias to an on-server directory path.directory_roles: grants read/write rights on that alias to roles.efilename(directory, filename): constructs anefilelocator.readEfile(efile): reads the target file intobytea.writeEfile(bytea, efile): writesbyteato the target file.copyEfile(src, dest): copies one external file to another.getEfilePath(efile, need_read, need_write): resolves the full path and checks access.
Caveats
- Creating the extension requires a PostgreSQL superuser.
- Upstream creates all objects in the
external_fileschema by default. - The PostgreSQL OS user still needs filesystem read/write permission on the target directory.
- Filenames must not contain
/or\; access is intentionally mediated through the directory tables.
Was this page helpful?
Thanks—your feedback helps us improve this page.
What got in the way? (optional)