How Do I Change The 'Owner' of a Database?

Started by pwover 21 years ago4 messagesgeneral
Jump to latest
#1pw
p.willis@telus.net

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

#2Steven Klassen
sklassen@commandprompt.com
In reply to: pw (#1)
Re: How Do I Change The 'Owner' of a Database?

* 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

#3pw
p.willis@telus.net
In reply to: Steven Klassen (#2)
Re: How Do I Change The 'Owner' of a Database?

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:

Show quoted text

There might be something you can do with 'alter database' as well.

#4Steven Klassen
sklassen@commandprompt.com
In reply to: pw (#3)
Re: How Do I Change The 'Owner' of a Database?

* 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