Chapter 13 — Further Reading
Official reference (everyone)
- PostgreSQL Docs: "INSERT," "UPDATE," "DELETE," "TRUNCATE." The authoritative syntax, including
RETURNING,ON CONFLICT,UPDATE ... FROM, andDELETE ... USING. https://www.postgresql.org/docs/current/sql-insert.html - PostgreSQL Docs: "INSERT ... ON CONFLICT" (upsert) and "MERGE" (v15+). The two ways to do insert-or-update;
MERGEis the SQL-standard form. - PostgreSQL Docs: "Data Manipulation" tutorial chapter. A gentle overview tying the statements together.
Safety & operations (💻 Developer · 🏗️ DBA)
- psql
AUTOCOMMITand transaction settings. How to make your shell safe by default (Case Study 1).\set AUTOCOMMIT off,\set ON_ERROR_ROLLBACK on. - Articles/postmortems on "the missing WHERE clause." Cautionary tales (some famous) that make the habit stick. Every one is a procedural-defense lesson.
- "Idempotent data pipelines" writeups. Why upsert + idempotency makes jobs safe to retry (Case Study 2).
Concurrency preview (🔬 CS Student · 🏗️ DBA)
- "Race conditions" / "check-then-act" in databases. The general class of bug behind Case Study 2; you'll formalize it in Chapter 27 (lost updates, isolation).
- Transactions intro — read ahead to Chapter 26 if you want the why behind
BEGIN/COMMIT/ROLLBACKnow.
Performance preview (🏗️ DBA)
- Bulk loading with
COPY(Chapter 31): the fast path for inserting many rows. - Batching large
UPDATE/DELETE— articles on deleting millions of rows without locking a busy table for too long (ties to Chapters 27–28).
Reference (this book)
- Appendix C — SQL Quick Reference: DML syntax (INSERT/UPDATE/DELETE/UPSERT).
- Appendix J — Dialect Differences:
RETURNINGvsOUTPUT,ON CONFLICTvsON DUPLICATE KEYvsMERGE.
Do, don't just read
- Practice the safe sequence on Mercado (preview
SELECT→BEGIN→ change → verify →ROLLBACK). Make it muscle memory before you ever touch production. - Reproduce Case Study 2's race conceptually: two
BEGINs in twopsqlwindows inserting the samesku; watch the unique constraint fire; then fix it withON CONFLICT. - Turn
AUTOCOMMIT offin a practice session and feel how every change now waits for yourCOMMIT.
Next: Chapter 14 — Data Definition: CREATE, ALTER, DROP — building well-constrained tables.