How to check if autocommit is enabled or not postgres' psql

I am using postgres 9.5. How to check whether auto power on or off? I tried SHOW AUTOCOMMIT , where I got ERROR: unrecognized configuration parameter "autocommit" , then I did \set autocommit off , and then SHOW AUTOCOMMIT gave me empty output. How to determine if auto-commit is on or off? Also can I disconnect it in / after the database in sql file?

+6
source share
1 answer

According to this article by Dustin Marx, you can use:

 \echo :AUTOCOMMIT 

If the user has β€œalways” disabled startup, \ set AUTOCOMMIT from the meta-command can be added to one local ~ / .psqlrc file. For even more global settings, this meta-command can be placed in the apsqlrc file in the database system configuration directory (which can be located using the command at the PostgreSQL operating system level pg_config --sysconfdir).

+8
source

Source: https://habr.com/ru/post/1013458/


All Articles