PostgreSQL error code
PostgreSQL error 2D000
2D000 is the SQLSTATE PostgreSQL reports for invalid transaction termination, in class 2D, Invalid Transaction Termination.
| SQLSTATE | 2D000 |
|---|---|
| Condition name | invalid_transaction_termination |
| Class | 2D — Invalid Transaction Termination |
Reproduce it, then fix it
A DO block or procedure can only COMMIT when it isn’t running inside an outer transaction. This sandbox runs every query in one, as does any client that has already sent BEGIN. Let the caller commit. Run the broken query to see the error, then switch to the fixed one. Edit either freely; every run is rolled back.
DO $$ BEGIN UPDATE products SET price = price * 1.1; COMMIT; END $$;
DO $$ BEGIN UPDATE products SET price = price * 1.1; END $$;