SQL Dialects & Portability

SQL Portability Strategy

Portability is the ability to move or support a workload with known, tested costs—not the absence of vendor features. Keep invariants and a useful relational/query core portable, isolate consequential differences behind explicit adapters, and specialize deliberately when the operational or correctness gain pays for the boundary.
  • Choose a portability target, not an aspiration.
  • Portable does not mean lowest common denominator.
  • Separate syntax from semantics.
  • Make the database boundary observable.
  • Migrations are part of the portability contract.
  • Cross-dialect tests need semantic oracles.
Layered portability boundary
Portability decision framework
DecisionPortable coreAdapter/capability boundaryEvidence
IntegrityPK/FK/unique/check and explicit nullabilitydeferral, exclusion/predicate featuresrace tests on real engines
Queriesjoins, predicates, aggregates, stable orderingpagination, upsert, returning, JSON/searchresult + concurrency contracts
Typesbounded semantic domain and conversion rulesnative UUID/JSON/time-zone/binary typesboundary/overflow round trips
Transactionsshort unit, rollback, retry protocolisolation mapping, lock hints/modesanomaly and deadlock tests
Evolutionlogical target schemaonline-DDL and migration stepsupgrade rehearsal and timing
OperationsRPO/RTO and telemetry requirementsbackup, replication, failover toolingrestore/failover drills
Capability contract
DatabaseCapabilities {
  serverProduct, serverVersion, driverVersion
  generatedKeyStrategy
  paginationStrategy
  conflictWriteStrategy
  ddlAtomicityClass
  supportedIsolationContracts
}

At startup: detect and reject unsupported combinations.
In CI: run the same contract suite on every supported version.
In production: expose chosen capabilities as bounded telemetry.