Clearly I am misunderstanding rollbacks in PostgreSQL, why doesn't work this piece of script?:
do $$
begin
insert into mytable values (1);
insert into mytable values (1);
exception when others then
ROLLBACK;
end;
$$ language 'plpgsql';
ERROR: cannot begin/end transactions in PL/pgSQL HINT: Use a BEGIN block with an EXCEPTION clause instead. CONTEXT: PL/pgSQL function inline_code_block line 13 at SQL statement *** Error ***