← Files SQL CopilotARCHIVED FILE
references/safe-write-checklist.md
1.35 KB · Nov 15, 2026 · 06:40 UTC
# Safe SQL write review ## Before you prepare a change Identify target environment, object, precise key/predicate, expected count and whether data can be restored. Separate (1) **read-only inspection** from (2) **mutating execution** in visible output. For DELETE/UPDATE/MERGE, preflight the exact target predicate and row set. Check source duplicates for join-based modifications; confirm zero/NULL key handling. For wide-impact changes, require an affected-row estimate and a recovery plan. ## Actions by risk - SELECT and EXPLAIN of read-only statements: lower risk; EXPLAIN ANALYZE behavior is dialect-dependent and may execute a statement. - INSERT/CTAS: creates or modifies state; check idempotency and volume. - UPDATE/DELETE/MERGE: high risk of silent multi-match or broad predicates. - TRUNCATE/DROP/ALTER/GRANT/REVOKE: high consequence; review locks, lineage and permission changes. ## Transaction boundaries A transaction is helpful only if the operation and platform actually support rollback. Some DDL or warehouse operations commit implicitly or involve asynchronous effects. Don't promise universal rollback. ## Checklist for a separate execution block `Run only after validating scope` with explicit environment, backup/restore information, approval and row-bound expectations. In a tools-enabled environment, do not execute based solely on having written SQL.
SHA-256: fab5f8c441372ac88696885e18dcd50c6d1f2cebade78afd39ff10c3559f41d8