Portability testing
Overview
Portability testing compares a declared result and error contract on every target engine and version. A common fixture is necessary but not sufficient: check types, NULLs, duplicates, ordering, constraints and transaction effects as well as values.
First example
SELECT a.category,a.id FROM dc_item a WHERE NOT EXISTS(SELECT 1 FROM dc_item b WHERE b.category=a.category AND (b.cents>a.cents OR (b.cents=a.cents AND b.id<a.id))) ORDER BY a.category;Observed SQLite result (rows in JSON):
[ [ "a", 2 ], [ "b", 4 ]]How it works
Use ordered comparisons only when ordering is specified; otherwise compare multisets that preserve duplicates. Define explicit normalization for decimals and timestamps without hiding semantic differences. Record version, collation, session settings, permissions and fixture migration; distinguish unsupported, partial, extension-dependent, deprecated and unknown features. The local suite checks two formulations of top-one-per-group and empty results. A cross-engine CI job must actually connect to each target and report failures or skips independently; no local substitute qualifies as native evidence.
Practical example
SELECT COUNT(*),SUM(cents) FROM dc_item WHERE id=99;Observed SQLite result (rows in JSON):
[ [ 0, null ]]Practice and mistakes
Practice: compare a ROW_NUMBER result to NOT EXISTS. Hint: a better item has greater cents or equal cents and smaller id. Verify duplicates in unsorted reports and ties in ordered reports. Mistake: using set equality that hides duplicate rows.
Oracle 19c example — NOT RUN
SELECT id,cents FROM dc_item ORDER BY cents,id OFFSET 2 ROWS FETCH NEXT 2 ROWS ONLY;Expected result, not executed: "Rows (3,200),(4,300)."