I currently log in to PostgreSQL using psql -U postgres. How do I rename postgres user to root?
If I am already logged in as postgres then trying ALTER USER postgres RENAME TO root will say ERROR: session user cannot be renamed.
Is it possible to rename the user without logging as postgres user? I don’t think I have any other superuser since this is a fresh install of PostgreSQL.
By the way, I am running Gentoo on Amazon EC2.
You should be able to just create a new postgres superuser called root by logging in as the postgres user and (at the shell) typing;
After that, when logged in as root, you should be able to do what you want with the postgres user.