pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Gaetano Mendola <mendola@bigfoot.com>
To: pgsql-admin@postgresql.org
Subject: ExclusiveLock and Python
Date: Wed, 26 Feb 2003 12:30:38 +0100
Message-ID: <b3i8gp$1gqp$1@news.hub.org> (raw)

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






view thread (4+ messages)  latest in thread

Message-ID: <b3i8gp$1gqp$1@news.hub.org>
Permalink:  ../b3i8gp$1gqp$1@news.hub.org/
Also on:    postgresql.org/message-id/b3i8gp$1gqp$1@news.hub.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-admin@postgresql.org
  Cc: mendola@bigfoot.com
  Subject: Re: ExclusiveLock and Python
  In-Reply-To: <b3i8gp$1gqp$1@news.hub.org>
  References: <b3i8gp$1gqp$1@news.hub.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox