pgrand
pgrand · Generates random test data through a PostgreSQL FDW, with an experimental table access method.
Overview
PostgreSQL · 15, 16
Usage
Sources:
pgrand generates synthetic rows through a PostgreSQL foreign data wrapper. It is intended for quickly filling test tables or producing arrays for vector tests; the generated values are test data, not statistically uniform or cryptographically secure randomness.
Core Workflow
The extension installs random_fdw_handler, but the wrapper and server must be created explicitly.
The foreign-table option total controls the number of rows emitted by a scan and defaults to 1000. A nonzero random.seed initializes a repeatable ChaCha8 stream for each scan; the default 0 uses entropy.
GUCs
random.min_intandrandom.max_intbound integer generation.random.min_text_lengthandrandom.max_text_lengthbound text length.random.array_lengthsets array length from1to16384.random.float_scalecontrols generated floating-point scale.random.seedselects deterministic or entropy-seeded output.
The implementation generates many common numeric, text, array, JSON, network, and geometric PostgreSQL types. Unsupported types yield NULL rather than a value.
Caveats
Upstream explicitly states that generated numbers are not evenly distributed and user-defined types are unsupported. The table access method is still marked in progress; the documented usable surface is the FDW. Scans synthesize all requested rows and do not push predicates to an external source, so use total conservatively and materialize only the data required. The reviewed 0.1.0 Cargo feature matrix targets PostgreSQL 15 and 16; the extension is non-relocatable and requires superuser installation. No preload or restart is required.