an honest observer
an honest observer

Reputation: 11

Is it possible to rollback only one command (not whole transaction) in SQL?

I know that you do the BEGIN; command, then all commands after that can be rolled back, as long as you haven't executed COMMIT; yet. My question is, is there a command to roll back just one command and not ALL commands after the BEGIN? I'm using Postgres by the way.

Upvotes: 0

Views: 1088

Answers (1)

Bill Karwin
Bill Karwin

Reputation: 562310

Read https://www.postgresql.org/docs/14/tutorial-transactions.html about SAVEPOINT and ROLLBACK TO SAVEPOINT.

Upvotes: 2

Related Questions