0

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

1 Answers1

0

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.

Phill W.
  • 9,889
  • 1
  • 12
  • 24