FIND YOUR NEXT FEW LINES
The snippet library.
Small, practical examples. Search by task or narrow things down below.
125 snippets foundClear filters
Undo a multi-row transfer atomically
Postgres: The first transaction commits the fixtures. Rolling back the second transaction restores both sides of the attempted transfer.
Postgres✓ Tested
Undo only the work after a savepoint
Postgres: After committing the fixtures, roll back a trial change while keeping earlier work in the second transaction.
Postgres✓ Tested
Update one row using its primary key
Postgres: Use a precise WHERE condition to change only the intended row in a scratch table.
Postgres✓ Tested
Update rows selected by a related table
Postgres: Use EXISTS to limit updates based on an independent eligibility table.
Postgres✓ Tested
Update several classifications in one statement
Postgres: A CASE expression computes the new value for each row covered by the update predicate.
Postgres✓ Tested