Tom,
I think the reason Oracle (and possibly others databases) do it the
otherway (i.e. implicit commit if session is closed normally) is to
require an explicit rollback, instead of requiring an explicit commit.
The assumption being that most of the time you want to commit the
changes you just made. Since this is the common case don't require a
commit in this case (save the user some work). The corner case is when
you don't want your changes and thus it makes sense to require a
rollback in this case. In Oracle's SQLPlus the default is to commit on
exit, but that can be changed to rollback on exit if desired.
Having said that, personally I agree with your position. So perhaps it
might make sense to do the following: At the server level don't issue
an implicit commit at connection close. However psql could have a mode
that does issue an implicit commit when it exits. This would make it
possible for psql to mirror the behavior of Oracle's SQLPlus.
thanks,
--Barry
Tom Lane wrote:
> Mike Mascari <mascarm@mascari.com> writes:
>
>>So would it be
>>possible to modify PQFinish() to examine whether autocommit = true,
>>and if so, issue a commit before disconnect, else just disconnect?
>>
>
> That's just a slightly different way of shooting yourself in the foot.
> What's the difference whether it's libpq or the backend that pulls
> the trigger? It's still not an explicit decision by the client.
>
> I guess I do not understand the motivation for this proposal.
> As I see it, the idea is that the client does not want an autocommit,
> so he sets an option saying "no autocommit, hold transaction open until
> I explicitly commit". Why exactly would such a client think that an
> autocommit on disconnect is a good idea? The whole POINT is to require
> an explicit commit command. (ie, the client wants the gun in his own
> hand, no delegation of the trigger decision, thank you very much)
>
> ISTM people who like autocommit will be using our existing behavior.
>
> regards, tom lane
>
> ---------------------------(end of broadcast)---------------------------
> TIP 2: you can get off all lists at once with the unregister command
> (send "unregister YourEmailAddressHere" to majordomo@postgresql.org)
>
>