Skip to content

Add lesson: upsert with ON CONFLICT#16

Open
exekias wants to merge 1 commit into
mainfrom
lesson/07-upsert
Open

Add lesson: upsert with ON CONFLICT#16
exekias wants to merge 1 commit into
mainfrom
lesson/07-upsert

Conversation

@exekias
Copy link
Copy Markdown
Member

@exekias exekias commented May 28, 2026

Summary

  • New Module 2 lesson 07-upsert (module-relative 03-upsert).
  • Covers INSERT … ON CONFLICT DO UPDATE (with the EXCLUDED pseudo-table), the insert-path of the same statement, DO NOTHING for idempotent inserts, and a conditional WHERE on the UPDATE branch.
  • Three checks: a counter-bump upsert, a fresh-insert upsert, and a DO-NOTHING dedup.

Note: this PR uses module-relative slot 03- assuming #15 (02-delete-and-lifecycle) lands first. The validator allows gaps in lesson order, so this can also merge independently — if it lands first, there's just a 01/03 gap in module 2 until #15 fills it.

Part of #6.

Test plan

  • npm run lessons:validate
  • npx tsc --noEmit
  • npm run lint
  • Manual: walk through the lesson in /lessons/07-upsert/preview and verify each <Run> works against the seed

🤖 Generated with Claude Code

Covers INSERT … ON CONFLICT DO UPDATE / DO NOTHING, the EXCLUDED
pseudo-table, conditional updates with a WHERE on the UPDATE
branch, and the idempotent-insert use case. Three checks
exercise both the update and insert paths plus DO NOTHING.

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:49pm

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