How to rename a database?

Started by Farzad FARIDalmost 28 years ago4 messagesgeneral
Jump to latest
#1Farzad FARID
farzy@publicis.fr

How do I rename an existing database? Is it enough to just rename the
directory? If that's the only way to do it do I have to first shut the
server down?

--
Farzad FARID
Administrateur Reseau
Publicis Technology

#2Aleksey Dashevsky
postgres@luckynet.co.il
In reply to: Farzad FARID (#1)
Re: [GENERAL] How to rename a database?

Use following syntax:
alter table <Old_Table_Name> rename to <New_Table_Name>

Al.

On Wed, 8 Jul 1998, Farzad FARID wrote:

Show quoted text

How do I rename an existing database? Is it enough to just rename the
directory? If that's the only way to do it do I have to first shut the
server down?

--
Farzad FARID
Administrateur Reseau
Publicis Technology

#3James Olin Oden
joden@lee.k12.nc.us
In reply to: Aleksey Dashevsky (#2)
Re: [GENERAL] How to rename a database?

Use following syntax:
alter table <Old_Table_Name> rename to <New_Table_Name>

I don't think that will work for the entire database. Remember a table is
part of the database. So I don't think alter will change the actual
database's name...

Show quoted text

How do I rename an existing database? Is it enough to just rename the
directory? If that's the only way to do it do I have to first shut the
server down?

--
Farzad FARID
Administrateur Reseau
Publicis Technology

#4Jackson, DeJuan
djackson@cpsgroup.com
In reply to: James Olin Oden (#3)
RE: [GENERAL] How to rename a database?

try:
pg_dump <old_database> > tmp.sql
then edit tmp.sql to change the old_database name to new_database name.
then:
cat tmp.sql | psql template1
-DEJ

Show quoted text

-----Original Message-----
From: James Olin Oden [SMTP:joden@Lee.k12.nc.us]
Sent: Thursday, July 09, 1998 11:45 AM
To: Aleksey Dashevsky
Cc: Farzad FARID; pgsql-general@postgreSQL.org
Subject: Re: [GENERAL] How to rename a database?

Use following syntax:
alter table <Old_Table_Name> rename to <New_Table_Name>

I don't think that will work for the entire database. Remember a
table is
part of the database. So I don't think alter will change the actual
database's name...

How do I rename an existing database? Is it enough to just rename

the

directory? If that's the only way to do it do I have to first shut

the

server down?

--
Farzad FARID
Administrateur Reseau
Publicis Technology