alter table question
alter table question
От:
Medi Montaseri <medi@cybershell.com>
Дата:
How can I alter a column's data type in PG? If PG does not support such a change, what is a typical or clever way of doing that? I had to drop-create table a couple of times, but that does not feel right. I know informix allows you to do that. Thanks -- ------------------------------------------------------------------------- Medi Montaseri medi@CyberShell.com Unix Distributed Systems Engineer HTTP://www.CyberShell.com CyberShell Engineering -------------------------------------------------------------------------
Re: alter table question
От:
"Gregory Wood" <gregw@com-stock.com>
Дата:
One option would be to rename the column (IIRC, that's allowable by PostgreSQL) and then add the column back in with the datatype that you want, then repopulate that field with the data from the old column. Of course, this just creates an unused, unwanted column just hanging around. Not to mention that it could be a real problem if the column is part of a foreign key or has constraints tied to it. Personally, if you can afford to do it, I think drop-create is the best solution, as painful as that is to admit. Greg ----- Original Message ----- From: "Medi Montaseri" To: Sent: Saturday, March 02, 2002 3:43 AM Subject: [GENERAL] alter table question > How can I alter a column's data type in PG? > > If PG does not support such a change, what is a typical or clever > way of doing that? > > I had to drop-create table a couple of times, but that does not > feel right. I know informix allows you to do that. > > Thanks > > -- > ------------------------------------------------------------------------- > Medi Montaseri medi@CyberShell.com > Unix Distributed Systems Engineer HTTP://www.CyberShell.com > CyberShell Engineering > ------------------------------------------------------------------------- > > > > > ---------------------------(end of broadcast)--------------------------- > TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org >