Hi, all,
How can I change the column definition of an existing table, ie. from
varchar(30) to varchar(50)? Is there any way to add a new column to an
existing table?
Thank you for your suggestions.
Chuming Chen
---(end of broadcast)---
TIP 7:
Peter Eisentraut wrote:
Chuming Chen wrote:
How can I change the column definition of an existing table, ie. from
varchar(30) to varchar(50)? Is there any way to add a new column to
an existing table?
The ALTER TABLE command can do all that. You need version 8.0 or later
for some
On Tue, Jun 28, 2005 at 09:27:32AM -0400, Chuming Chen wrote:
How can I change the column definition of an existing table, ie. from
varchar(30) to varchar(50)? Is there any way to add a new column to an
existing table?
See ALTER TABLE in the documentation and How do you change a
column's
On Tuesday 28 June 2005 15:27, Chuming Chen wrote:
Hello,
How can I change the column definition of an existing table, ie. from
varchar(30) to varchar(50)?
You did not mention any version, so for 8.0.x:
alter table t alter col type varchar(50);
Is there any way to add a new column to an
: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Chuming Chen
Sent: Tuesday, June 28, 2005 8:40 AM
To: Peter Eisentraut
Cc: pgsql-admin@postgresql.org
Subject: Re: [ADMIN] change existing table definition
Peter Eisentraut wrote:
Chuming Chen wrote:
How can I change the column definition
Hi
ALTER TABLE is only in PostgreSQL 8. But you can create a new table
with varchar(50) and copy the data from the existing into the new
table. How much relation_size has your table? Do you create the
dbsize-functions which are included in the contrib package?
Best regards,
Martin
Am
Chuming Chen wrote:
Peter Eisentraut wrote:
Chuming Chen wrote:
How can I change the column definition of an existing table, ie. from
varchar(30) to varchar(50)? Is there any way to add a new column to
an existing table?
The ALTER TABLE command can do all that. You need version 8.0
Hi,
Thanks a lot for your quick reply and help. The following is what I find
from google. Will it work?
A quicker solution would be to use the pg_dump command
to dump the table, change the needed columns and restore
everything.
pg_dump -c -t table name database dumpfile
psql database
pg_dump -c -t table name database dumpfile
psql database dumpfile
I don't tested this but i think this works.
Be dangerous with the -c Option of dump ;). After
the dump was created, new data could be inserted into the
database. If you dump in the file, all dumped tables are
dropped. It's