all statements in postgresql are self contained transactions, and you cannot change that. To answer your question directly, you don't have to, it will all be a transaction.
The best example of that is to run following query in psql:
CREATE TEMP TABLE foo() ON COMMIT DROP;
the table will not exists anymore after running it. Precisely because it was 'automatically' wrapped in begin/commit, and dropped at the end of it.
Чтобы сделать работу с сайтом удобнее, мы используем cookie и аналитический сервис «Яндекс.Метрика». Продолжая пользоваться сайтом, вы соглашаетесь с их использованием.