Postgres setting autocommit off globally

前端 未结 2 905
孤独总比滥情好
孤独总比滥情好 2021-01-18 02:08

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

相关标签:
2条回答
  • 2021-01-18 02:32

    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?

    0 讨论(0)
  • 2021-01-18 02:43

    Use a transaction if you want want a (open) transaction:

    BEGIN;
      INSERT ...;
      UPDATE ...;
    COMMIT; -- when you're done
    
    0 讨论(0)
提交回复
热议问题