Skip to content

pg_someone

Session notices and optional playful query hooks

pg_someone · Session notices and optional playful query hooks

Overview

IDExtensionPackageVersionCategoryLicenseLanguage
102472pg_someonepg_someone0.1.0SIMPostgreSQLC

PostgreSQL · 14, 15, 16, 17, 18, 19

Usage

Sources:

pg_someone 0.1.0 is an experimental entertainment extension for PostgreSQL 14–19. It emits session-dependent notices, remembers answers and dropped tables, and can simulate another session. It is unsuitable for applications that require unaltered query results when its optional rewrite behavior is enabled.

Enablement and interaction

The hooks must be loaded when a session starts. Add the library to the existing preload list. Shared preload requires a server restart and can start the phantom worker; session preload applies to new sessions and does not start that worker.

session_preload_libraries = 'pg_someone'

Install the SQL objects as a superuser in each intended database. The extension uses the fixed someone schema and is not relocatable.

CREATE EXTENSION pg_someone;
SET someone.allow_rewrite = off;
SET someone.allow_refusal = off;
SELECT someone.apologize();
SELECT someone.offer('milk');

Questions accept an answer in a comment on the following statement. someone.answers and someone.offerings store per-user history with row-level policies; someone.graves is shared. These tables are included in extension configuration dumps.

Configuration

someone.intensity ranges from 0 to 3, with default 1. someone.only_interactive defaults to on and restricts behavior to application names beginning with psql. someone.seed defaults to 0 for random behavior; a fixed seed supports reproducible tests.

someone.allow_rewrite and someone.allow_refusal default to off. Enabling the first may reduce a top-level SELECT limit or add a result column; enabling the second may refuse dropping or truncating an attached table. Do not enable them on a production workload.

someone.phantom defaults to on and someone.phantom_database to postgres; both need a restart. The worker requires shared preload. Its reported query and transaction state are theatrical: it opens no transaction or snapshot, but its real database connection can prevent operations requiring exclusive database access. An absent target database causes retries and logged errors.

Operational boundaries

The worker appears in activity monitoring with backend type someone and restarts after termination. Filter that backend type when interpreting monitoring. Ordinary writes are not rewritten. Internal catalog work uses subtransactions; read-only transactions receive messages without history writes. Superuser-only testing controls can force behavior or a clock value; leave them unset outside deliberate tests.

Table reader