Re: SET autocommit begins transaction? - Mailing list pgsql-bugs

From Bruce Momjian
Subject Re: SET autocommit begins transaction?
Date
Msg-id 200209182205.g8IM5wE17493@candle.pha.pa.us
Whole thread Raw
In response to Re: SET autocommit begins transaction?  (Sean Chittenden <sean@chittenden.org>)
Responses Re: SET autocommit begins transaction?  (Sean Chittenden <sean@chittenden.org>)
List pgsql-bugs
Sean Chittenden wrote:
> db.transaction do |dbh|
>   db.do('DELETE FROM tbl WHERE id = 5')
>   db['AutoCommit'] = true
> end
>
> Because there wasn't a commit given, that shouldn't actually delete
> the rows found, but by tossing that AutoCommit in there, it should and
> will generate a nifty warning if AutoCommit sends the above
> BEGIN/SET/COMMIT.  -sc

You can't be setting autocommit willy-nilly.  What I was going to
suggest is that we allow 'SET autocommit' only at the start of a
transaction, and then have it take effect immediately.  If you try
autocommit when a transaction is already in progress from a previous
statement, we throw an error.

--
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073

pgsql-bugs by date:

Previous
From: Sean Chittenden
Date:
Subject: Re: SET autocommit begins transaction?
Next
From: Tom Lane
Date:
Subject: Re: SET autocommit begins transaction?