Thread: How Do I Change The 'Owner' of a Database?
Hello, I used a user to create a database but postgreSQL insists that the 'postgres' user is the owner. It's a bit annoying to have to change users to link sequences to counter values. How can I cahnge the owner of the database to the proper user? Peter
* pw <p.willis@telus.net> [2004-10-12 13:48:30 -0700]: > How can I cahnge the owner of the database to the proper user? UPDATE pg_database SET datdba = (SELECT usesysid FROM pg_user WHERE usename = 'user_name') WHERE datname = 'database_name; There might be something you can do with 'alter database' as well. -- Steven Klassen - Lead Programmer Command Prompt, Inc. - http://www.commandprompt.com/ PostgreSQL Replication & Support Services, (503) 667-4564
Thanks for your help, I was looking at ALTER DATABASE but the docs don't disclose any attributes so *what the heck does one ALTER?* I'll try the query that you offered. Peter Steven Klassen wrote: > > There might be something you can do with 'alter database' as well. >
* pw <p.willis@telus.net> [2004-10-12 14:11:51 -0700]: > I was looking at ALTER DATABASE but the docs don't disclose any > attributes so *what the heck does one ALTER?* The actual settings are kind of nestled in the documentation a layer or two deep. Here are the pertinent URLs and neither of them have anything to do with ownership, FWIW. ;) http://www.postgresql.org/docs/current/interactive/sql-alterdatabase.html http://www.postgresql.org/docs/current/interactive/runtime-config.html Best Regards, -- Steven Klassen - Lead Programmer Command Prompt, Inc. - http://www.commandprompt.com/ PostgreSQL Replication & Support Services, (503) 667-4564