postgres pgAdmin - ghdrako/doc_snipets GitHub Wiki
In pgAdmin, the option "Auto rollback on error" is disabled by default. For this reason, ROLLBACK will not automatically occur if an error occurs. To fix this, (in pgAdmin 8.14) you need to open Preferences, then Query Tool, and then Options. There, you can enable the "Auto rollback on error" option. Then click Save and close the settings window. After that, open a new Query Tool window, type, and execute your SQL query. If an error occurs, ROLLBACK will be executed automatically.