adminpack
administrative functions for PostgreSQL
adminpack : administrative functions for PostgreSQL
Overview
| ID | Extension | Package | Version | Category | License | Language |
|---|---|---|---|---|---|---|
| 5970 | adminpack | adminpack | 2.1 |
ADMIN | PostgreSQL | C |
| Attribute | Has Binary | Has Library | Need Load | Has DDL | Relocatable | Trusted |
|---|---|---|---|---|---|---|
| --s-d-- | No | Yes | No | Yes | no | no |
| Relationships | |
|---|---|
| See Also | pg_checksums amcheck pg_repack pg_catcheck pg_surgery pg_orphaned pg_pathcheck pg_isok pageinspect pg_squeeze |
Packages
| PG18 | PG17 | PG16 | PG15 | PG14 |
|---|---|---|---|---|
| N/A | N/A | 2.1 | 2.1 | 2.1 |
This is a built-in contrib extension ship with the PostgreSQL kernel
Install
Create this extension with:
Usage
The adminpack extension provides server-side file management and log access functions, primarily used by pgAdmin and other administration tools. All functions are restricted to superusers by default.
File Operations
Log File Access
Returns timestamps and paths of log files from the log_directory.
Function Reference
| Function | Returns | Description |
|---|---|---|
pg_file_write(filename, data, append) |
bigint | Write text to file; returns bytes written |
pg_file_sync(filename) |
void | Flush file or directory to disk |
pg_file_rename(old, new [, archive]) |
boolean | Rename file, optionally archiving existing target |
pg_file_unlink(filename) |
boolean | Delete a file |
pg_logdir_ls() |
setof record | List log files with timestamps |
Access Control
- All functions default to superuser-only access
- Permissions can be granted via
GRANTto non-superusers - File access is restricted to the database cluster directory unless the user has
pg_read_server_filesorpg_write_server_filesroles
Note: adminpack was removed in PostgreSQL 17. For PostgreSQL 16 and earlier only.