implicit_schema
pg_implicit_schema · Event-trigger extension that automatically creates a schema when a table or view is created in a missing schema.
Overview
| ID | Extension | Package | Version | Category | License | Language |
|---|---|---|---|---|---|---|
| 100607 | implicit_schema | pg_implicit_schema | 0.1 | FEAT | MIT | C |
Usage
Sources:
- Official README and warning
- Version 0.1 installation SQL
- Event-trigger implementation
- Extension control file
implicit_schema installs an event trigger that creates a missing schema when a schema-qualified table or view is created. It is a narrow compatibility hack for software that generates schema names but cannot provision the schemas itself.
Core Workflow
The extension defines auto_create_schema() and an event trigger named auto_create_schema on ddl_command_start. Version 0.1 handles only CREATE TABLE and CREATE VIEW; other object types do not acquire this behavior.
Operational and Security Boundaries
Upstream explicitly calls the extension a bad idea. It silently turns one object-creation attempt into an additional CREATE SCHEMA IF NOT EXISTS operation, changing privilege, audit, locking, and error expectations cluster-wide in the database where it is installed.
The reviewed C implementation interpolates the requested schema name into dynamic SQL without escaping an embedded double quote. Do not expose schema-qualified object creation to untrusted names or users. Prefer explicit schema provisioning; if compatibility requires this extension, isolate it, test adversarial identifiers and concurrent DDL, and audit every role that can create tables or views.