Skip to content

Add lesson: upsert with ON CONFLICT - #16

Merged
exekias merged 2 commits into
mainfrom
lesson/07-upsert
Jun 2, 2026
Merged

Add lesson: upsert with ON CONFLICT#16
exekias merged 2 commits into
mainfrom
lesson/07-upsert

Conversation

@exekias

@exekias exekias commented May 28, 2026

Copy link
Copy Markdown
Member

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

vercel Bot commented May 28, 2026

Copy link
Copy Markdown

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

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

@exekias
exekias merged commit 6aed12f into main Jun 2, 2026
4 checks passed
@exekias
exekias deleted the lesson/07-upsert branch June 2, 2026 13:32
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