pg.ddx.io pgsql-sql@postgresql.org mailing list archive
help / color / mirror / Atom feedTurn autocommit off ?
5+ messages / 4 participants
[nested] [flat]
* Turn autocommit off ?
@ 1998-09-17 14:12 Andreas Joppich <ajoppich@usa.net>
0 siblings, 3 replies; 5+ messages in thread
From: Andreas Joppich @ 1998-09-17 14:12 UTC (permalink / raw)
To: pgsql-sql
Hi there !
It has now happened several times that I wanted to rollback some
changes (like update, delete,...) I made to some tables. And since I
always forget to start a transaction, a simple ROLLBACK doesn't work
because of that quiet annoying autocommit in psql.
I'd like to have automatically started a transaction which explicitly
must be termintated with commit or rollback.
Is there a way to turn autocommit off ? If not, perhaps it could
be a feature for the todo list ?
I'm currently using the cvs from last sunday on linux 2.1.119.
Thanks for any hints.
Andreas
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: [SQL] Turn autocommit off ?
@ 1998-09-17 14:46 Federico Passaro <fede@link.it>
parent: Andreas Joppich <ajoppich@usa.net>
2 siblings, 1 reply; 5+ messages in thread
From: Federico Passaro @ 1998-09-17 14:46 UTC (permalink / raw)
To: pgsql-sql
Andreas Joppich wrote:
> Hi there !
>
> It has now happened several times that I wanted to rollback some
> changes (like update, delete,...) I made to some tables. And since I
> always forget to start a transaction, a simple ROLLBACK doesn't work
> because of that quiet annoying autocommit in psql.
>
> I'd like to have automatically started a transaction which explicitly
> must be termintated with commit or rollback.
>
> Is there a way to turn autocommit off ? If not, perhaps it could
> be a feature for the todo list ?
>
> I'm currently using the cvs from last sunday on linux 2.1.119.
>
> Thanks for any hints.
>
> Andreas
You can edit your ~/.psqlrc (or /etc/psqlrc) an put a
begin;
line into it. The drawback is that if you do not issue a "commit"
command you loose all your changes.
Cheers
federico
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: [SQL] Turn autocommit off ?
@ 1998-09-17 16:00 Bruce Momjian <maillist@candle.pha.pa.us>
parent: Andreas Joppich <ajoppich@usa.net>
2 siblings, 0 replies; 5+ messages in thread
From: Bruce Momjian @ 1998-09-17 16:00 UTC (permalink / raw)
To: ajoppich@usa.net; +Cc: pgsql-sql
> Hi there !
>
> It has now happened several times that I wanted to rollback some
> changes (like update, delete,...) I made to some tables. And since I
> always forget to start a transaction, a simple ROLLBACK doesn't work
> because of that quiet annoying autocommit in psql.
>
> I'd like to have automatically started a transaction which explicitly
> must be termintated with commit or rollback.
>
> Is there a way to turn autocommit off ? If not, perhaps it could
> be a feature for the todo list ?
>
> I'm currently using the cvs from last sunday on linux 2.1.119.
Ingres does this. I will add it to the TODO list.
--
Bruce Momjian | 830 Blythe Avenue
maillist@candle.pha.pa.us | Drexel Hill, Pennsylvania 19026
http://www.op.net/~candle | (610) 353-9879(w)
+ If your life is a hard drive, | (610) 853-3000(h)
+ Christ can be your backup. |
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: [SQL] Turn autocommit off ?
@ 1998-09-17 16:02 Bruce Momjian <maillist@candle.pha.pa.us>
parent: Federico Passaro <fede@link.it>
0 siblings, 0 replies; 5+ messages in thread
From: Bruce Momjian @ 1998-09-17 16:02 UTC (permalink / raw)
To: fede@link.it; +Cc: ajoppich@usa.net; pgsql-sql
> Andreas Joppich wrote:
>
> > Hi there !
> >
> > It has now happened several times that I wanted to rollback some
> > changes (like update, delete,...) I made to some tables. And since I
> > always forget to start a transaction, a simple ROLLBACK doesn't work
> > because of that quiet annoying autocommit in psql.
> >
> > I'd like to have automatically started a transaction which explicitly
> > must be termintated with commit or rollback.
> >
> > Is there a way to turn autocommit off ? If not, perhaps it could
> > be a feature for the todo list ?
> >
> > I'm currently using the cvs from last sunday on linux 2.1.119.
> >
> > Thanks for any hints.
> >
> > Andreas
>
> You can edit your ~/.psqlrc (or /etc/psqlrc) an put a
>
> begin;
>
> line into it. The drawback is that if you do not issue a "commit"
> command you loose all your changes.
The problem with this is that is that when he does his first COMMIT, he
is not started in a new transaction block.
--
Bruce Momjian | 830 Blythe Avenue
maillist@candle.pha.pa.us | Drexel Hill, Pennsylvania 19026
http://www.op.net/~candle | (610) 353-9879(w)
+ If your life is a hard drive, | (610) 853-3000(h)
+ Christ can be your backup. |
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: [SQL] Turn autocommit off ?
@ 1998-09-18 17:29 Peter T Mount <peter@retep.org.uk>
parent: Andreas Joppich <ajoppich@usa.net>
2 siblings, 0 replies; 5+ messages in thread
From: Peter T Mount @ 1998-09-18 17:29 UTC (permalink / raw)
To: Andreas Joppich <ajoppich@usa.net>; +Cc: pgsql-sql
On Thu, 17 Sep 1998, Andreas Joppich wrote:
> Hi there !
>
> It has now happened several times that I wanted to rollback some
> changes (like update, delete,...) I made to some tables. And since I
> always forget to start a transaction, a simple ROLLBACK doesn't work
> because of that quiet annoying autocommit in psql.
>
> I'd like to have automatically started a transaction which explicitly
> must be termintated with commit or rollback.
>
> Is there a way to turn autocommit off ? If not, perhaps it could
> be a feature for the todo list ?
You didn't say if it was from psql or one of the other interfaces.
With JDBC, you turn autocommit off with the setAutoCommit() method in
Connection:
To turn off:
Connection con = DriverManager.getConnection(url,user,password);
con.setAutoCommit(false);
>
> I'm currently using the cvs from last sunday on linux 2.1.119.
>
> Thanks for any hints.
>
> Andreas
>
--
Peter T Mount peter@retep.org.uk
Main Homepage: http://www.retep.org.uk
PostgreSQL JDBC Faq: http://www.retep.org.uk/postgres
Java PDF Generator: http://www.retep.org.uk/pdf
^ permalink raw reply [nested|flat] 5+ messages in thread
end of thread, other threads:[~1998-09-18 17:29 UTC | newest]
Thread overview: 5+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
1998-09-17 14:12 Turn autocommit off ? Andreas Joppich <ajoppich@usa.net>
1998-09-17 14:46 ` Federico Passaro <fede@link.it>
1998-09-17 16:02 ` Bruce Momjian <maillist@candle.pha.pa.us>
1998-09-17 16:00 ` Bruce Momjian <maillist@candle.pha.pa.us>
1998-09-18 17:29 ` Peter T Mount <peter@retep.org.uk>
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