Thread: How to set "auto commit" off in postgresql db?
Hi: It seems to me that postgresql db's default set for commit is "on". I would like to set it to "off". How could I do that? TIA. ---------- Here is what I got when testing: webstore=> create table t1 (col1 varchar(10)); CREATE webstore=> insert into t1 (col1) values ('test123'); INSERT 1006769 1 webstore=> select * from t1; col1 --------- test123 (1 row) webstore=> rollback; NOTICE: ROLLBACK: no transaction in progress ROLLBACK webstore=> select * from t1; col1 --------- test123 (1 row) Get your FREE download of MSN Explorer at http://explorer.msn.com
[Please don't mail in HTML] On Thu, Jan 11, 2001 at 21:02:56 -0000, Guang Mei wrote: > It seems to me that postgresql db's default set for commit is "on". Erm, it's not PostgreSQL itself, but rather the "psql" interface. > I would like to set it to "off". How could I do that? By explicitly starting a transaction through "BEGIN WORK". HTH, Ray -- FUD for dummies by example in 21 days Lesson 3: use braindead analogies. "Open source raises various security issues. How many banks will tell you where their cameras are and where their vaults are?" A Microsoft droid in http://www.zdnet.co.uk/news/1999/47/ns-11895.html
Someone will correct me if I'm wrong, but I'm pretty sure all you have to do is start a transaction. Example: begin; create table t1 (col1 varchar(10)); insert into t1 (col1) values ('test123'); rollback; Greg ----- Original Message ----- From: Guang Mei To: pgsql-general@postgresql.org Sent: Thursday, January 11, 2001 4:02 PM Subject: How to set "auto commit" off in postgresql db? Hi: It seems to me that postgresql db's default set for commit is "on". I would like to set it to "off". How could I do that? TIA. ---------- Here is what I got when testing: webstore=> create table t1 (col1 varchar(10)); CREATE webstore=> insert into t1 (col1) values ('test123'); INSERT 1006769 1 webstore=> select * from t1; col1 --------- test123 (1 row) webstore=> rollback; NOTICE: ROLLBACK: no transaction in progress ROLLBACK webstore=> select * from t1; col1 --------- test123 (1 row) ---------------------------------------------------------------------------- -- Get your FREE download of MSN Explorer at http://explorer.msn.com