Skip site navigation (1) Skip section navigation (2)

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 (view raw or flat)
Thread:
Lists: pgsql-generalpgsql-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

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

pgsql-general by date

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

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group