disable autocommit in PostgreSQL 13 on Oracle Linux 8

All we need is an easy explanation of the problem, so here it is.

I know this question has been asked before. I am new to PostgreSQL and would like to turn off "autocommit" forever. After some research, I need to add "\set AUTOCOMMIT off" in the ~/.psqlrc file. Where do I find this file ~/.psqlrc? in directory /var/lib/pgsql/13/data/ I do not find it. I created it "vi ~/.psqlrc" and inserted the command \set AUTOCOMMIT, but it did not work. What is missing here? I would be very happy about any tip.

Many greetings, Ahmed

How to solve :

I know you bored from this bug, So we are here to help you! Take a deep breath and look at the explanation of your problem. We have many solutions to this problem, But we recommend you to use the first method because it is tested & true method that will 100% work for you.

Method 1

Where do I find this file ~/.psqlrc?

That already is the full path to the file.
Linux shells expand the "~" character into the path to the current user’s Home directory, so something like /home/username.
The leading "." in the filename makes it a hidden file, so it won’t show up in directory listings (ls) unless you include the "-a" flag. This is a security measure.

However, this is only for the current user.
If another user connects through psql, and they don’t have this file with this command in it, you’re shiny, new setting won’t apply to them.
Apparently, making a single psqlrc file for everyone is quite a challenge.

Note: Use and implement method 1 because this method fully tested our system.
Thank you 🙂

All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply