SoftwareRadar PostgreSQL NULL and transaction example
Observed on 17 October 2026
https://softwareradar.co.uk/software/postgresql/#postgresql-null-example

The recorded run used PostgreSQL 17.11 (Homebrew). The SQL uses fictional TEMP
tables and example.invalid email strings. It tests constraints and explicit
transaction behaviour, not hosting performance, concurrency, backups or recovery.

FILES
postgresql-null-demo.py: creates, runs, stops and removes its own temporary cluster.
postgresql-null-demo.sql: companion psql script; keep beside the Python runner.
postgresql-null-observations.json: actual version, row counts and SQLSTATE results.
postgresql-null-README.txt: scope and reproduction instructions.

REPRODUCE
Requires Python 3 and installed PostgreSQL 15+ server tools on a POSIX system.
The postgres, initdb, pg_ctl and psql binaries must come from the same installation.
The postgres binary must be on PATH. Run as a normal operating-system user.
Extract all files into one folder, then run:

python3 postgresql-null-demo.py

The runner accepts no existing database connection arguments. It discards PG*
connection settings, uses its own empty password file, bypasses psql startup files and creates a new private
temporary cluster. TCP listening is disabled; the Unix socket uses peer
authentication and owner-only permissions. It does not install software, make
network requests or connect to an existing database. Expected constraint errors
are captured and asserted. The JSON result is printed only after the runner
confirms its server stopped and removes its temporary files. If stop confirmation
fails, the runner reports the retained temporary path instead of removing it.

Do not paste the SQL into a working application transaction. Run the supplied
Python file. The companion SQL checks a fixture-only server marker before making
any tables, and deliberately contains psql commands and expected errors.

OBSERVED RESULT
Ordinary UNIQUE: two NULLs accepted. Repeated non-null text and repeated empty
strings were rejected with 23505. Four accepted records remained.
UNIQUE NULLS NOT DISTINCT: first NULL accepted; second NULL rejected with 23505.
NOT NULL: NULL rejected with 23502; the empty text string was accepted.
Explicit transaction: duplicate rejected with 23505, next query rejected with
25P02; a full rollback left zero rows.
Separate savepoint transaction: rollback to the pre-error savepoint allowed a new
valid insert. Commit retained IDs 1 and 3, two rows total.

The installed PostgreSQL version may differ on reproduction. Keep the fresh
output, check the assertions and review the documentation for that version.
This is a small synthetic example, not validation of an application or ORM.
