ADR-0003 — pinky export: last-SELECT-wins execution model
Status: accepted Date: 2026-05-31
Context
A .sql file passed to pinky export may contain multiple statements: session
variable SETs, intermediate CTEs, DML warm-ups, and a final SELECT to export.
Only one result is exported to xlsx.
Decision
The last statement in the file is the one exported. All preceding statements are executed for side effects (SET, DML, intermediate SELECTs). If the last statement is not a SELECT, the command fails immediately with a clear error message.
Consequences
Forces good SQL hygiene — the export query is always the last and most visible thing in the file. No silent partial exports. Callers know exactly which result they will get without reading the implementation.