Re: Why are 'select1; commit' run along with 'set autocommit=on' when turning autocommit on again on a jdbc connection

Поиск
Список
Период
Сортировка
От Oliver Jowett
Тема Re: Why are 'select1; commit' run along with 'set autocommit=on' when turning autocommit on again on a jdbc connection
Дата
Msg-id 20031002205345.GB14745@opencloud.com
обсуждение исходный текст
Ответ на Why are 'select1; commit' run along with 'set autocommit=on' when turning autocommit on again on a jdbc connection  ("Mushran, Vrinda" <Vrinda@netopia.com>)
Список pgsql-jdbc
On Wed, Oct 01, 2003 at 09:23:07AM -0700, Mushran, Vrinda wrote:

> Why does the postgres jdbc driver execute 'select 1' and 'commit' followed
> by 'set autocommit = on'? Setting autocommit on again should just result in
> 'set autocommit=on' statement to be executed, not 'select 1' and 'commit'.
> User would not expect commit to be issued by just turning autocommit on and
> thus its execution here alarms me.

Committing the existing transaction is correct behaviour. The JDBC javadoc
for setAutoCommit includes this:

     NOTE: If this method is called during a transaction, the transaction is committed.

Whether committing when the existing transaction hasn't done any work is
"correct" seems to be a non-issue since it'll always be harmless by
definition.

-O

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

Предыдущее
От: Barry Lind
Дата:
Сообщение: Re: Why are 'select1; commit' run along with 'set autocommit=on'
Следующее
От: "balaji"
Дата:
Сообщение: Postgresql 7.3.4 download problem