pg_disorder
Overview
| Package | Version | Category | License | Language |
|---|---|---|---|---|
pg_disorder | 0.1.0 | FEAT | PostgreSQL | C |
| ID | Extension | Bin | Lib | Load | Create | Trust | Reloc | Schema |
|---|---|---|---|---|---|---|---|---|
| 2880 | pg_disorder | No | Yes | Yes | No | No | No | - |
| Related | plan_filter pg_hint_plan pg_mockable pgtap pg_simula pg_fiu pg_crash |
|---|
Headless loadable module with no control file and no CREATE EXTENSION step; intended only for test databases; load per session with session_preload_libraries and never enable globally in production.
Version
| Type | Repo | Version | PG Ver | Package | Deps |
|---|---|---|---|---|---|
| EXT | PIGSTY | 0.1.0 | 1817161514 | pg_disorder | - |
| RPM | PIGSTY | 0.1.0 | 1817161514 | pg_disorder_$v | - |
| DEB | PIGSTY | 0.1.0 | 1817161514 | postgresql-$v-pg-disorder | - |
Build
You can build the RPM / DEB packages for pg_disorder using pig build:
Install
You can install pg_disorder directly. First, make sure the PGDG and PIGSTY repositories are added and enabled:
Install the extension using pig or apt/yum/dnf:
Preload:
Usage
Sources:
pg_disorder is a test-only PostgreSQL loadable module that deliberately changes the output order of eligible SELECT queries. It helps find applications and tests that accidentally depend on unspecified row order. It is a headless module: there is no control file, SQL install script, or CREATE EXTENSION pg_disorder step.
Enable It for a Test Database
Load the module at session start so its planner hook is available:
Reconnect after changing session_preload_libraries. Do not add this module to a production-wide shared_preload_libraries setting.
Modes
offleaves plans unchanged.reversedeterministically reverses eligible output.shuffleproduces a deterministic permutation for a fixed session seed, submitted query text, and plan. With the default seed of zero, each session first chooses and logs a random seed.force_serialsuppresses parallel plans to make disorder tests reproducible.
Always fix a failing query by adding a semantically correct ORDER BY; do not encode the accidental order observed under off.
Eligibility and Caveats
The hook targets top-level SELECT statements without ORDER BY. It deliberately skips query shapes where reordering is unsafe or changes SQL semantics, including aggregates, grouping, DISTINCT, set operations, window functions, recursive queries, row locks, and queries without a FROM relation.
pg_disorderis fault-injection tooling, not a production query feature.- Passing a disorder run does not prove every unordered query is safe; excluded query shapes and planner paths are not rewritten.
- The package installs a server module only. Verify enablement with the GUCs or module load state, not
pg_extension.
Was this page helpful?
Thanks—your feedback helps us improve this page.
What got in the way? (optional)