I'm a bit new to transaction in postgresql. I read many tutorials in it but what i want to do is that... If i have many queries for example:
INSERT INTO a (id) VALUES (1)
INSERT INTO a (id) VALUES (2)
INSERT INTO a (id) VALUES (3)
INSERT INTO a (id) VALUES (4)
....
if it failed in the 3rd or any nth query because of some issue, what i want is to rollback all the other previous queries automatically.
My question is, is there any way to do that in postgresql?