Unfortunately, I have removed super user privileges from postgres user in PostgreSQL. And currently I have not any super user in PostgreSQL. And i want to make superuser. So how can i make it ? Every time I am trying to make postgres to super user. I am facing this problem.
Error : must be superuser to alter superusers.
You're going to have to stop the database system and start a stand-alone back-end, which always unconditionally runs as a superuser.
You can use this backend to
ALTERthe user you wish to give superuser rights to. Then shut the standalone backend down and start the database normally.It is important that you completely stop the database server before entering single user mode. PostgreSQL single user mode will refuse to start if there's a postmaster, but to be sure you should make sure there are no PostgreSQL processes running on your system. Under (almost) no circumstances should you ever delete
postmaster.pid- that's pretty much guaranteed to result in database corruption if there's still any PostgreSQL process accessing that data directory.Exactly how to start a standalone back-end depends a bit on your OS/distro and how you installed PostgreSQL. You haven't included this info, so I can only really point you at the manual for the
postgresback-end executable.Make a backup first.
See the section Options for Single User mode and, toward the bottom, Usage. You'll want to run the
postgresbackend with--single, as the unix user that owns the database files, with the path to the datadir. On a typical Linux PostgreSQL install this might be something like:Your datadir and
postgresexecutable location are quite possibly different. The above is for a Fedora system running with PGDG PostgreSQL packages from http://yum.postgresql.org/ .