> pg_dump -c -t >
> psql <
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 better to RENAME the existing table and
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 >
psql <
Regards,
Chuming
Martin Fandel
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
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 Dienstag,
Aehm sorry. ALTER TABLE is not only in PostgreSQL 8 ;). Only the
datatypes can be changed in postgres 8 (right?). I answered to fast.
I'm sorry.
CREATE TABLE newtable ( "bla" varchar(50));
CREATE INDEX/TRIGGER/... (with different names as the production table)
INSERT INTO newtable (select * from p
: [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 ch
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
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
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 fu
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 functionality though.
--
Peter
10 matches
Mail list logo