# Composite UNIQUE: comparison rules and NULL grouping

Status: source-reviewed constructed demonstration for issue #6333, supplemental
to #6301. No new engine defect, benchmark or field frequency is claimed.

## Finding
The same input sequence can produce different accepted rows under BINARY and
built-in NOCASE. In both nullable fixtures, three groups have count 2 even
though every successful write obeys UNIQUE and integrity_check returns ok.
UNIQUE and GROUP BY intentionally apply different NULL rules.

## Method
Python sqlite3 creates four fresh in-memory databases in autocommit mode:
BINARY versus NOCASE text comparison, crossed with nullable versus NOT NULL
key columns. Each executes the same twelve numbered INSERT attempts. IDs are
explicit attempt numbers; a rejected attempt leaves a gap, not a reused ID.
No custom collation or function is registered.

Each attempt records parameters, acceptance, exact extended error code/name,
and every row in ID order with SQLite storage types. The fixed oracle specifies
outcomes independently of query plans. It checks all 48 resulting table states,
not only counts or the final success status. The final GROUP BY audit and full
integrity_check are recorded separately.

ASCII A/a and non-ASCII U+00C4/U+00E4 control the case-folding scope.
Other steps test a changed second component, an exact repeated pair, and
repeated NULL in the first, second and both components. These are designed
cases, not independent statistical trials.

## Reproduce
Requires Python 3.11+ with sqlite3 and extended error attributes; standard
library only. The saved run is Python 3.12.3 / SQLite 3.45.1. An independent
agent replayed its answers on Python 3.12.14 / SQLite 3.53.1. These are two
software environments, not independent human replication.

```sh
python3 -B uniqueness.py --check observations.json
python3 -B -m unittest -v test_uniqueness
python3 -B -O -m unittest -v test_uniqueness
python3 -B uniqueness.py --summary observations.json
python3 -B uniqueness.py --output fresh-observations.json
```

Output creation refuses to overwrite an existing file. --check runs fresh
SQLite fixtures and compares typed semantics with saved evidence. The capture
date, runtime and compile options describe the producer and intentionally differ
between environments. They are not presented as identical binary builds.
summary.json is generated by --summary, never hand-entered.

## Evidence and limits
observations.json contains 48 dependent attempts across four databases. The
original #6301 five-query evidence is not modified or rebranded.
No UPDATE, DELETE, concurrent writer, file backup/reopen, crash, durable-write,
custom Unicode collation, performance or PostgreSQL execution is tested.
NOT NULL rejects missing values; it does not choose an application's identity
policy or imply that every business identifier should be non-null.

Primary-source claim mapping and independent review: SOURCE_REVIEW.md.
INSERTION.md targets the existing SQLite analysis and composite-index record;
do not create another article or alias slug for this demonstration.
