pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Wolfgang Wilhelm <wolfgang20121964@yahoo.de>
To: Thomas Kellerer <spam_eater@gmx.net>
To: pgsql-admin@postgresql.org <pgsql-admin@postgresql.org>
Subject: Re: Autocommit off in psql
Date: Wed, 5 Nov 2014 10:17:23 +0000 (UTC)
Message-ID: <656182952.847732.1415182643649.JavaMail.yahoo@jws11170.mail.ir2.yahoo.com> (raw)
In-Reply-To: <m3cms9$f0j$1@ger.gmane.org>
References: <m3cms9$f0j$1@ger.gmane.org>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-admin>

Hello Thomas,
first of all thank you for your answer.
This is basically what I found via Google, too, but is that up to date information? I found some more info that that setting isn't valid anymore.
When I do that command which you sent, it seems to execute but when I do 

show AUTOCOMMIT; 

I get as as a result:
 autocommit------------
 on
(1 line)
When I do the command which you mentioned with a semicolon at the end I get an error message: Unknow boolean value: "on" assumed - well, at least I guess it should be something like that because I get that in german.
I tried with several other boolean values like 0, false, none, all with the same result of show AUTOCOMMIT;
Just a minute ago I realized that the output of show AUTOCOMMIT is somehow, well, misleading. First I did setting autocommit off. Then I inserted some data in a table. Another insert, a third. If autocommit would be on I'd expect it to do a commit after every insert. But a rollback made them all three disappear. I found that in the help text of the show command AUTOCOMMIT is not included. The question is why show outputs some info. But that shouldn't be your problem.
Thank you for you assistance!
RegardsWolfgang



 

     Thomas Kellerer <spam_eater@gmx.net> schrieb am 9:25 Mittwoch, 5.November 2014:
   

 

Wolfgang Wilhelm schrieb am 05.11.2014 um 09:08:
> There's an annoying difference between the database command line
> tools. Oracle doesn't have a BEGIN for a transaction start but needs
> a commit for saving changes. Psql on the other hand requires BEGIN to
> start an transaction or it will be in autocommit mode. Guess how much
> not so nice words I've heard in the last days because my team forgets
> that transaction begin...
> 
> Is there any way to make psql work a little bit more like sqlplus?
> "Set autocommit off" is obviously no solution as it's not valid
> anymore. 

You can use

  \set AUTOCOMMIT off

in psql to turn off autocommit mode (note that this is case-sensitive!)

I have that line in my psqlrc file so autocommit is automatically turned off.
(although I rarely use psql or sqlplus)


Regards
Thomas




-- 
Sent via pgsql-admin mailing list (pgsql-admin@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-admin


   

view thread (6+ messages)  latest in thread

Message-ID: <656182952.847732.1415182643649.JavaMail.yahoo@jws11170.mail.ir2.yahoo.com>
Permalink:  ../656182952.847732.1415182643649.JavaMail.yahoo@jws11170.mail.ir2.yahoo.com/
Also on:    postgresql.org/message-id/656182952.847732.1415182643649.JavaMail.yahoo@jws11170.mail.ir2.yahoo.com

 · 

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 using the --to and --cc options:
  reply via email

  To: pgsql-admin@postgresql.org
  Cc: wolfgang20121964@yahoo.de, spam_eater@gmx.net
  Subject: Re: Autocommit off in psql
  In-Reply-To: <656182952.847732.1415182643649.JavaMail.yahoo@jws11170.mail.ir2.yahoo.com>

* 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