change owner of database -- answer

From: "Zot O'Connor" <zot(at)zotconsulting(dot)com>
To: pgsql-general(at)postgresql(dot)org, postgres sql <pgsql-sql(at)hub(dot)org>
Subject: change owner of database -- answer
Date: 2000-03-07 04:47:21
Message-ID: 38C489D9.8B286BD7@zotconsulting.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-sql

This was posted several times as a question, here is the answer that I used:

use createdb from whereever...

\d pg_database

Table = pg_database
+----------------------------------+----------------------------------+-------+
| Field | Type | Length|
+----------------------------------+----------------------------------+-------+
| datname | name | 32 |
| datdba | int4 | 4 |
| encoding | int4 | 4 |
| datpath | text | var |
+----------------------------------+----------------------------------+-------+

=> select * from pg_database;
datname |datdba|encoding|datpath
-----------+------+--------+-----------
template1 | 124| 0|template1
mydatabase | 124| 0|mydatabase

I then sent
UPDATE pg_database SET datdba=99 WHERE datname=mydatabase;

And it updated the owner of the DB.

This area needs documentation!

--
Zot O'Connor

http://www.ZotConsulting.com
http://www.WhiteKnightHackers.com

Browse pgsql-general by date

  From Date Subject
Next Message Howie 2000-03-07 08:39:19 Re: [GENERAL] 50 MB Table
Previous Message Ed Loehr 2000-03-07 03:44:39 Re: [GENERAL] database corruption?

Browse pgsql-sql by date

  From Date Subject
Next Message Tom Lane 2000-03-07 07:13:56 Re: [SQL] index file's growing big
Previous Message Wendy L. Fry 2000-03-06 20:23:53 datetime conversion to JDBC