change owner of database -- answer - Mailing list pgsql-sql

From Zot O'Connor
Subject change owner of database -- answer
Date
Msg-id 38C489D9.8B286BD7@zotconsulting.com
Whole thread Raw
List 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

pgsql-sql by date:

Previous
From: "Wendy L. Fry"
Date:
Subject: datetime conversion to JDBC
Next
From: Tom Lane
Date:
Subject: Re: [SQL] index file's growing big