rdacker@pacbell.net (rdack) wrote in message news:<644f6688.0110011048.51982136@posting.google.com>...
> from python using PgSQL.
> i get:
> " libpq.OperationalError: ERROR: CREATE DATABASE: may not be called
> in a transaction block"
>
> in a python script i do :
> db = PgSQL.connect(database='template1')
> cur=db.cursor()
> cur.execute("create database tt2")
> cur.close()
> del db, cur
>
> how does one not be in a transaction block?
> what is the correct way to create a db?
answer is to use libpq module. low level interface has method to
execute queries without wrapping in a transaction:
import libpq
db = libpq.PQconnectdb('dbname=%s' % db_name)
db.query('create database %s' % tbl_name)