How do you set autocommit off in psql 8.4 at a global level? is there a configuration attribute that i can change that will introduce this behaviour for all dbs on a cluster to start db sessions with autocommit off?
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
Simply add the following to ~/.psqlrc
:
\set AUTOCOMMIT off
Note that this only works when using the psql
shell! I assume this is what you are talking about?
回答2:
Use a transaction if you want want a (open) transaction:
BEGIN;
INSERT ...;
UPDATE ...;
COMMIT; -- when you're done