Postgresql does not actually support returning multiple result sets from a single command. If you pass this input to psql:
BEGIN;
SELECT ...;
END;
he will split this client side and actually execute three statements, only the second of which returns a result set.
"BEGIN" "END" - SQL / . ( , ). , , , , , (psycopg2) . , Perl DBI AutoCommit = > 0 "BEGIN" ; "END" ( "COMMIT" ..), $dbh- > commit; , Python DB-API , , JDBC, ...