block_copy_command
Overview
| Package | Version | Category | License | Language |
|---|---|---|---|---|
block_copy_command | 0.1.5 | SEC | BSD-3-Clause | Rust |
| ID | Extension | Bin | Lib | Load | Create | Trust | Reloc | Schema |
|---|---|---|---|---|---|---|---|---|
| 7430 | block_copy_command | No | Yes | Yes | Yes | No | No | - |
Requires shared_preload_libraries = block_copy_command.
Version
| Type | Repo | Version | PG Ver | Package | Deps |
|---|---|---|---|---|---|
| EXT | PIGSTY | 0.1.5 | 1817161514 | block_copy_command | - |
| RPM | PIGSTY | 0.1.5 | 1817161514 | block_copy_command_$v | - |
| DEB | PIGSTY | 0.1.5 | 1817161514 | postgresql-$v-block-copy-command | - |
Build
You can build the RPM / DEB packages for block_copy_command using pig build:
Install
You can install block_copy_command directly. First, make sure the PGDG and PIGSTY repositories are added and enabled:
Install the extension using pig or apt/yum/dnf:
Preload:
Create Extension:
Usage
- Source: README
block_copy_command installs a ProcessUtility hook that intercepts COPY statements. The hook is cluster-wide once the library is loaded, while CREATE EXTENSION only registers metadata in a database.
Enable It
Blocking Rules
By default, non-superusers cannot run COPY TO or COPY FROM:
Priority is documented as:
block_copy_command.blocked_roles: always blocked, even superusers.block_copy_command.block_program = on: blocksCOPY ... PROGRAMfor everyone.block_copy_command.enabled = off: allowsCOPYfor roles not inblocked_roles.- Superusers otherwise bypass direction blocking.
block_copy_command.block_toandblock_copy_command.block_fromcontrol export/import blocking for non-superusers.
Main Settings
block_copy_command.enabled: master switch for non-superuser blocking.block_copy_command.block_to: blockCOPY TO.block_copy_command.block_from: blockCOPY FROM.block_copy_command.block_program: blockCOPY TO/FROM PROGRAMfor all users.block_copy_command.hint: append a customHINTto blocked-command errors.block_copy_command.blocked_roles: comma-separated always-blocked roles.block_copy_command.audit_log_enabled: write intercepted events to the audit table.
Audit And Caveats
Allowed and blocked attempts are intercepted, and the extension defines block_copy_command.audit_log plus server-log entries for blocked events. The README notes one important caveat: blocked audit rows are inserted before the error is raised, so they are rolled back with the transaction. In practice, PostgreSQL server logs are the authoritative record for blocked COPY attempts.
Was this page helpful?
Thanks—your feedback helps us improve this page.
What got in the way? (optional)