Relative Content

Tag Archive for sqlpostgresqltransactions

SQL current transaction is aborted and commands ignored, how to fix it?

begin transaction; — start a transaction — first SQL command with savepoint SAVEPOINT sp_1; — your first INSERT command goes here — if it fails, you can rollback to savepoint sp_1 INSERT INTO “table_name” (“id”,”owner_id”) VALUES (1, 100); EXCEPTION WHEN others THEN ROLLBACK TO SAVEPOINT sp_1; RAISE NOTICE ‘The first INSERT failed: %’, SQLERRM; release […]