Creating a database from the Odoo CLI miserably fails with the error
"psycopg2.ProgrammingError: set_session cannot be used inside a
transaction".
Setting con.autocommit = True fails if some transaction is already
started, which is the case when creating a database. The fix consists
in rolling back the existing transaction (with only a SELECT) before
switching to autocommit.
closesodoo/odoo#68549
Signed-off-by: Raphael Collet (rco) <rco@openerp.com>