Skip to content

Add lesson: transactions basics#17

Open
exekias wants to merge 1 commit into
mainfrom
lesson/08-transactions-basics
Open

Add lesson: transactions basics#17
exekias wants to merge 1 commit into
mainfrom
lesson/08-transactions-basics

Conversation

@exekias
Copy link
Copy Markdown
Member

@exekias exekias commented May 28, 2026

Summary

  • New Module 2 lesson 08-transactions-basics (module-relative 04-transactions-basics).
  • Worked example is the canonical bank-account transfer. Covers BEGIN/COMMIT/ROLLBACK, the aborted-transaction state after a statement error, the BEGIN…ROLLBACK dry-run pattern, and SAVEPOINT/ROLLBACK TO SAVEPOINT for partial rollback. Closes with a rule-of-thumb section on transaction length.
  • Two checks: the post-transfer balance and the conservation of total funds.

Note: this PR uses module-relative slot 04- assuming #15 and #16 land first. The validator allows gaps, so this is mergeable independently.

Part of #6.

Test plan

  • npm run lessons:validate
  • npx tsc --noEmit
  • npm run lint
  • Manual: walk through the lesson in /lessons/08-transactions-basics/preview — confirm the SAVEPOINT example produces Linus at 106 and the aborted-tx example leaves Ada's balance unchanged

🤖 Generated with Claude Code

Covers BEGIN/COMMIT/ROLLBACK with the canonical account-transfer
example, the aborted-transaction state after a statement error,
the BEGIN…ROLLBACK dry-run pattern, and SAVEPOINT/ROLLBACK TO
SAVEPOINT for partial rollback. Closes with a "how long should
a transaction be" rule-of-thumb section.

Part of #6.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@vercel
Copy link
Copy Markdown

vercel Bot commented May 28, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
learn-postgres Ready Ready Preview May 28, 2026 2:51pm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant