sudo sh -c "echo 'deb http://apt.postgresql.org/pub/repos/apt/ xenial-pgdg main' > /etc/apt/sources.list.d/pgdg.list" wget --quiet -O - http://apt.postgresql.org/pub/repos/apt/ACCC4CF8.asc | sudo apt-key add - sudo apt-get update sudo apt-get install postgresql-common sudo apt-get install postgresql-9.5 libpq-dev
DO $$ DECLARE a INTEGER := 10; b INTEGER := 20; c INTEGER; BEGIN c := a + b; RAISE NOTICE'Value of c: %', c; END $$;
FOR i IN 1..100000 LOOP
UPDATE checklist_headers SET area_name = (SELECT name FROM areas WHERE id = (SELECT area_id FROM checklist_headers WHERE id = i)) WHERE id = i;
The problem is still your
pg_hba.conf file (/etc/postgresql/9.1/main/pg_hba.conf). This line:
[code type=txt]local all postgres peer
[code type=txt]local all postgres md5
After altering this file, don’t forget to restart your PostgreSQL server. If you’re on Linux, that would be
sudo service postgresql restart.
These are brief descriptions of both options according to the official PostgreSQL docs on authentication methods.
The peer authentication method works by obtaining the client’s operating system user name from the kernel and using it as the allowed database user name (with optional user name mapping). This method is only supported on local connections.
The password-based authentication methods are md5 and password. These methods operate similarly except for the way that the password is sent across the connection, namely MD5-hashed and clear-text respectively.
If you are at all concerned about password “sniffing” attacks then md5 is preferred. Plain password should always be avoided if possible. However, md5 cannot be used with the db_user_namespace feature. If the connection is protected by SSL encryption then password can be used safely (though SSL certificate authentication might be a better choice if one is depending on using SSL).