I want to run a script inside a transaction in PostgreSQL. So I surround the SQL code with
begin
and commit
statements. But I want to rollback
on error. I don't see how to do that.
BEGIN;
UPDATE public.tablename
SET blah = 'xxx'
WHERE thing= '123';
COMMIT;
Asked by Peter Marshall
(121 rep)
Dec 1, 2020, 03:49 PM
Last activity: Apr 23, 2023, 03:30 AM
Last activity: Apr 23, 2023, 03:30 AM