-1

There is an error while creating an extension of the performance benchmark in PostgreSQL. I have already made pawankukreja superuser, but it is not working and keeps giving me this error while following this manual.

cd ~
time psql postgres -c "select addme(floor(random() * (100-1+1) + 1) ::int+g from generate_series(1,1000000) as g" > out.txt

Output:

psql: error: connection to server on socket "/var/run/postgresql/.s.PGSQL.5432" failed: FATAL:
role "pawankukreja" is not permitted to log in

real 0m0.125s
user 0m0.050s
sys  0m0.040s

Screenshot

How can I fix it?

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131

5 Answers5

0

You've to make sure you've installed the correct version of PostgreSQL client and that you have initialized the server. Additionally, check if you've passed the correct path to the PostgreSQL client in the EXPORT and in the configuration file.

Typically, you can initialize the PostgreSQL server with this command:

pg_ctl init

Or

pg_ctl -D cluster_name start
Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Wendel
  • 763
  • 1
  • 12
0

Run the following commands:

initdb
pg_ctl -D /usr/local/pgsql-12/bin/data -l logfile start

If the error persists, I recommend you to reinstall PostgreSQL and AGE.

You can follow this tutorial at DEV: How to install pgsql and AGE

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Marcos Silva
  • 115
  • 5
0

I think the way postgres was installed created a user "postgres" with the needed privileges, so try logging in with this user:

sudo -u postgres -i

Then issue the command you're trying.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Marco Souza
  • 296
  • 7
0

There is another way you can try to solve that issue with the same username:

  1. Check user privileges: Verify that the user "pawankukreja" has the necessary privileges to log in

    psql -U postgres -c "SELECT rolname FROM pg_roles WHERE rolname = 'pawankukreja'"
    
  2. Grant privileges to the user

    psql -U postgres -c "ALTER ROLE pawankukreja LOGIN"
    
Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
0

This error indicates that the new user created does not have the permissions to log in.

You can give SUPERUSER privilege to the new user.

Use this code to create a user with superuser privilege.

CREATE USER <user> SUPERUSER;

And to grant superuser privilege to already created user

ALTER USER <user> WITH SUPERUSER;

For this to work, you have to be logged in as a user with superuser privilege.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
abhishek2046
  • 312
  • 1
  • 11