pg.ddx.io pgsql-admin@postgresql.org mailing list archive
help / color / mirror / Atom feedrename database
6+ messages / 5 participants
[nested] [flat]
* rename database
@ 2001-11-30 18:59 Leong, Fushan <fushan.leong@SonoSite.com>
0 siblings, 0 replies; 6+ messages in thread
From: Leong, Fushan @ 2001-11-30 18:59 UTC (permalink / raw)
To: pgsql-admin
Hi :
I am working on the procedure to restore a database from dump file ( pg_dump
). I am
thinking to create a new database, then restore the dump file, drop the old
database
and rename the old database to new database.
Do postgres has command to rename the database?
^ permalink raw reply [nested|flat] 6+ messages in thread
* rename database
@ 2008-02-06 19:42 Nuwan Liyanage <alnuwan2@yahoo.com>
0 siblings, 0 replies; 6+ messages in thread
From: Nuwan Liyanage @ 2008-02-06 19:42 UTC (permalink / raw)
To: pgsql-admin
Hi,
I am trying to rename my database; I used the following command,
Alter database postgres rename to post_dev;
but I get a error saying that the "current database may not be renamed"
I look at the documentation, and it says that I need to connect to a different database in order do that?
can someone please help me how to do that..
Thanks
alnuwan
---------------------------------
Never miss a thing. Make Yahoo your homepage.
^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: rename database
@ 2008-02-06 20:35 Nuwan Liyanage <alnuwan2@yahoo.com>
0 siblings, 1 reply; 6+ messages in thread
From: Nuwan Liyanage @ 2008-02-06 20:35 UTC (permalink / raw)
To: pgsql-admin
Ok I think I got it. I just went ahead and updated the pg_database table and it works..
Nuwan Liyanage <alnuwan2@yahoo.com> wrote: Hi,
I am trying to rename my database; I used the following command,
Alter database postgres rename to post_dev;
but I get a error saying that the "current database may not be renamed"
I look at the documentation, and it says that I need to connect to a different database in order do that?
can someone please help me how to do that..
Thanks
alnuwan
---------------------------------
Never miss a thing. Make Yahoo your homepage.
---------------------------------
Be a better friend, newshound, and know-it-all with Yahoo! Mobile. Try it now.
^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: rename database
@ 2008-02-06 22:33 Guillaume Lelarge <guillaume@lelarge.info>
parent: Nuwan Liyanage <alnuwan2@yahoo.com>
0 siblings, 1 reply; 6+ messages in thread
From: Guillaume Lelarge @ 2008-02-06 22:33 UTC (permalink / raw)
To: Nuwan Liyanage <alnuwan2@yahoo.com>; +Cc: pgsql-admin
Nuwan Liyanage wrote:
> Ok I think I got it. I just went ahead and updated the pg_database table
> and it works..
>
A better way is to connect to another database (template1 for exemple,
but you would better use another one) and fire your statement there.
Updating system table can be dangerous.
--
Guillaume.
http://www.postgresqlfr.org
http://dalibo.com
^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: rename database
@ 2008-02-07 03:52 Mag Gam <magawake@gmail.com>
parent: Guillaume Lelarge <guillaume@lelarge.info>
0 siblings, 1 reply; 6+ messages in thread
From: Mag Gam @ 2008-02-07 03:52 UTC (permalink / raw)
To: Guillaume Lelarge <guillaume@lelarge.info>; +Cc: Nuwan Liyanage <alnuwan2@yahoo.com>; pgsql-admin
what's the right way to rename a database then?
On Feb 6, 2008 5:33 PM, Guillaume Lelarge <guillaume@lelarge.info> wrote:
> Nuwan Liyanage wrote:
> > Ok I think I got it. I just went ahead and updated the pg_database table
> > and it works..
> >
>
> A better way is to connect to another database (template1 for exemple,
> but you would better use another one) and fire your statement there.
>
> Updating system table can be dangerous.
>
>
> --
> Guillaume.
> http://www.postgresqlfr.org
> http://dalibo.com
>
> ---------------------------(end of broadcast)---------------------------
> TIP 3: Have you checked our extensive FAQ?
>
> http://www.postgresql.org/docs/faq
>
^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: rename database
@ 2008-02-07 04:06 Robins Tharakan <tharakan@gmail.com>
parent: Mag Gam <magawake@gmail.com>
0 siblings, 0 replies; 6+ messages in thread
From: Robins Tharakan @ 2008-02-07 04:06 UTC (permalink / raw)
To: Mag Gam <magawake@gmail.com>; Nuwan Liyanage <alnuwan2@yahoo.com>; +Cc: Guillaume Lelarge <guillaume@lelarge.info>; pgsql-admin
Rightly as Guillaume said, tampering with a system table isn't a very good
idea.
This is what he suggested:
1. Lets say you are connected to Database A
2. Reconnect to Database B on the server (this database B could be any
database other than A on the server)
3. Rename database A to C
4. Reconnect to C
Without step 2, step 3 would always spew the error about unable to rename
the 'current database'.
*Robins*
---------- Forwarded message ----------
From: Mag Gam <magawake@gmail.com>
Date: Feb 7, 2008 9:22 AM
Subject: Re: [ADMIN] rename database
To: Guillaume Lelarge <guillaume@lelarge.info>
Cc: Nuwan Liyanage <alnuwan2@yahoo.com>, pgsql-admin@postgresql.org
what's the right way to rename a database then?
On Feb 6, 2008 5:33 PM, Guillaume Lelarge <guillaume@lelarge.info> wrote:
> Nuwan Liyanage wrote:
> > Ok I think I got it. I just went ahead and updated the pg_database table
> > and it works..
> >
>
> A better way is to connect to another database (template1 for exemple,
> but you would better use another one) and fire your statement there.
>
> Updating system table can be dangerous.
>
>
> --
> Guillaume.
> http://www.postgresqlfr.org
> http://dalibo.com
>
> ---------------------------(end of broadcast)---------------------------
> TIP 3: Have you checked our extensive FAQ?
>
> http://www.postgresql.org/docs/faq
>
^ permalink raw reply [nested|flat] 6+ messages in thread
end of thread, other threads:[~2008-02-07 04:06 UTC | newest]
Thread overview: 6+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2001-11-30 18:59 rename database Leong, Fushan <fushan.leong@SonoSite.com>
2008-02-06 19:42 rename database Nuwan Liyanage <alnuwan2@yahoo.com>
2008-02-06 20:35 Re: rename database Nuwan Liyanage <alnuwan2@yahoo.com>
2008-02-06 22:33 ` Guillaume Lelarge <guillaume@lelarge.info>
2008-02-07 03:52 ` Mag Gam <magawake@gmail.com>
2008-02-07 04:06 ` Robins Tharakan <tharakan@gmail.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