pg.ddx.io pgsql-admin@postgresql.org mailing list archive
help / color / mirror / Atom feedChanging a database owner on postgres 7.3
4+ messages / 3 participants
[nested] [flat]
* Changing a database owner on postgres 7.3
@ 2006-07-17 12:33 Richard George <rcgeorge23@hotmail.com>
0 siblings, 1 reply; 4+ messages in thread
From: Richard George @ 2006-07-17 12:33 UTC (permalink / raw)
To: pgsql-admin
Hi all,
I'm trying to tweak a schema creation script that works on postgres 8.x so that it will run on postgres 7.3.
I've run into trouble attempting to change the owner of a particular database. The offending line is -
ALTER DATABASE test OWNER TO epg;As I say, this works fine on postgres 8 but fails with the message "ERROR: parser: parse error at or near "OWNER" at character 87" on postgres 7.3."
Can someone suggest an alternative way of changing the owner of a database for 7.3?
Cheers,
Richard.
_________________________________________________________________
Be one of the first to try Windows Live Mail.
http://ideas.live.com/programpage.aspx?versionId=5d21c51a-b161-4314-9b0e-4911fb2b2e6d=
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: Changing a database owner on postgres 7.3
@ 2006-07-17 13:26 Devrim GUNDUZ <devrim@commandprompt.com>
parent: Richard George <rcgeorge23@hotmail.com>
0 siblings, 1 reply; 4+ messages in thread
From: Devrim GUNDUZ @ 2006-07-17 13:26 UTC (permalink / raw)
To: Richard George <rcgeorge23@hotmail.com>; +Cc: pgsql-admin
Hi,
On Mon, 2006-07-17 at 12:33 +0000, Richard George wrote:
> I've run into trouble attempting to change the owner of a particular
> database. The offending line is -
>
> ALTER DATABASE test OWNER TO epg;
There is no way to change ownership of a database with ALTER DATABASE in
7.3.X .
> Can someone suggest an alternative way of changing the owner of a
> database for 7.3?
AFAIR there is no quick-and-easy way to do that for 7.3. I'd create a
new database with a new username, and I'd use the old database as the
template:
CREATE DATABASE newdb WITH OWNER newuser TEMPLATE olddb;
could work for you.
Regards,
--
The PostgreSQL Company - Command Prompt, Inc. 1.503.667.4564
PostgreSQL Replication, Consulting, Custom Development, 24x7 support
Managed Services, Shared and Dedicated Hosting
Co-Authors: plPHP, plPerlNG - http://www.commandprompt.com/
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: Changing a database owner on postgres 7.3
@ 2006-07-17 13:43 Richard George <rcgeorge23@hotmail.com>
0 siblings, 0 replies; 4+ messages in thread
From: Richard George @ 2006-07-17 13:43 UTC (permalink / raw)
To: Devrim GUNDUZ <devrim@commandprompt.com>; +Cc: pgsql-admin
thanks for this- worked a treat!
> Subject: Re: [ADMIN] Changing a database owner on postgres 7.3> From: devrim@commandprompt.com> To: rcgeorge23@hotmail.com> CC: pgsql-admin@postgresql.org> Date: Mon, 17 Jul 2006 16:26:00 +0300> > Hi,> > On Mon, 2006-07-17 at 12:33 +0000, Richard George wrote:> > I've run into trouble attempting to change the owner of a particular> > database. The offending line is -> > > > ALTER DATABASE test OWNER TO epg;> > There is no way to change ownership of a database with ALTER DATABASE in> 7.3.X . > > > Can someone suggest an alternative way of changing the owner of a> > database for 7.3? > > AFAIR there is no quick-and-easy way to do that for 7.3. I'd create a> new database with a new username, and I'd use the old database as the> template:> > CREATE DATABASE newdb WITH OWNER newuser TEMPLATE olddb;> > could work for you.> > Regards,> -- > The PostgreSQL Company - Command Prompt, Inc. 1.503.667.4564> PostgreSQL Replication, Consulting, Custom Development, 24x7 support> Managed Services, Shared and Dedicated Hosting> Co-Authors: plPHP, plPerlNG - http://www.commandprompt.com/; > > > ---------------------------(end of broadcast)---------------------------> TIP 9: In versions below 8.0, the planner will ignore your desire to> choose an index scan if your joining column's datatypes do not> match
_________________________________________________________________
Be one of the first to try Windows Live Mail.
http://ideas.live.com/programpage.aspx?versionId=5d21c51a-b161-4314-9b0e-4911fb2b2e6d=
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: Changing a database owner on postgres 7.3
@ 2006-07-17 14:41 Chris Browne <cbbrowne@acm.org>
parent: Devrim GUNDUZ <devrim@commandprompt.com>
0 siblings, 0 replies; 4+ messages in thread
From: Chris Browne @ 2006-07-17 14:41 UTC (permalink / raw)
To: pgsql-admin
devrim@commandprompt.com (Devrim GUNDUZ) writes:
> Hi,
>
> On Mon, 2006-07-17 at 12:33 +0000, Richard George wrote:
>> I've run into trouble attempting to change the owner of a particular
>> database. The offending line is -
>>
>> ALTER DATABASE test OWNER TO epg;
>
> There is no way to change ownership of a database with ALTER DATABASE in
> 7.3.X .
>
>> Can someone suggest an alternative way of changing the owner of a
>> database for 7.3?
>
> AFAIR there is no quick-and-easy way to do that for 7.3. I'd create a
> new database with a new username, and I'd use the old database as the
> template:
>
> CREATE DATABASE newdb WITH OWNER newuser TEMPLATE olddb;
>
> could work for you.
I expect you could do the following:
update pg_database set datdba = (select usesysid from pg_shadow
where usename = 'epg') where datname = 'test';
Behind the scenes, that's probably what "ALTER DATABASE test OWNER TO
epg;" actually does.
--
output = reverse("gro.mca" "@" "enworbbc")
http://www.ntlug.org/~cbbrowne/emacs.html
"Catapultam habeo! Nisi pecuniam omnem mihi dabis, ad caput tuum
saxum immane mittam !!" (I have a catapult! If you do not pay me the
money you owe me, I will hit you with a big rock !!)
-- Simon Gornall <simon@unique-id.com>
^ permalink raw reply [nested|flat] 4+ messages in thread
end of thread, other threads:[~2006-07-17 14:41 UTC | newest]
Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2006-07-17 12:33 Changing a database owner on postgres 7.3 Richard George <rcgeorge23@hotmail.com>
2006-07-17 13:26 ` Devrim GUNDUZ <devrim@commandprompt.com>
2006-07-17 14:41 ` Chris Browne <cbbrowne@acm.org>
2006-07-17 13:43 Re: Changing a database owner on postgres 7.3 Richard George <rcgeorge23@hotmail.com>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox