ExclusiveLock and Python

Поиск
Список
Период
Сортировка
От Gaetano Mendola
Тема ExclusiveLock and Python
Дата
Msg-id b3i8gp$1gqp$1@news.hub.org
обсуждение исходный текст
Ответы Re: ExclusiveLock and Python  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-admin
Hi all,

doing the following query

select * from pg_locks where  mode = 'ExclusiveLock';

I obtain:


 relation | database | transaction |  pid  |     mode      | granted
----------+----------+-------------+-------+---------------+---------
          |          |     2560899 | 20404 | ExclusiveLock | t


ExclusiveLock on what ?

BTW I obtain this ExclusiveLock just doing a connection
with a Python program using the pgdb interface:

db_connection = pgdb.connect( )

and I obtain:

$> ps -eafwww  | grep post

postgres 10408 21357  0 12:02 ?        00:00:00 postgres: kalman kalman
[local] idle in transaction

I seen inside the pgdb.py code and I found that in the constructor of
pgdbCnx is performed:
    src.execute("BEGIN")

and the methods commit and rollback:


 def commit(self):
        try:
            src = self.__cnx.source()
            src.execute("COMMIT")
            src.execute("BEGIN")
        except:
            raise OperationalError, "can't commit."

    def rollback(self):
        try:
            src = self.__cnx.source()
            src.execute("ROLLBACK")
            src.execute("BEGIN")
        except:
            raise OperationalError, "can't rollback."


so it seem that is no an "autocommit" behaviour,
How can avoid to open a transaction if is not needed ?
Exist a way to emulate an autocommit behaviour or should I modify the
pgdb.py ?



Regards Gaetano




В списке pgsql-admin по дате отправления:

Предыдущее
От: Rajesh Kumar Mallah
Дата:
Сообщение: Re: PLSQL
Следующее
От: Daniel Rubio
Дата:
Сообщение: Limiting database size ...