Re: How to change data type in column ?
От | scott.marlowe |
---|---|
Тема | Re: How to change data type in column ? |
Дата | |
Msg-id | Pine.LNX.4.33.0304151027230.18680-100000@css120.ihs.com обсуждение исходный текст |
Ответ на | How to change data type in column ? ("Vitali Djatsuk" <Vitali.Djatsuk@MicroLink.ee>) |
Ответы |
Re: How to change data type in column ?
|
Список | pgsql-general |
On Tue, 15 Apr 2003, Vitali Djatsuk wrote: > > Hi, > > How can I change a data type in column ? There are a lot of issues involved in changing the type. I.e. what should the database do to "coerce" the data from one type to another that's already in the table. should the misformed data in the input be simply dropped and a null inserted, what if it's not null and doesn't fit, do we toss the row? not convert? The best way to get around these problems is to select the fields into a new table and coerce the type as you do it. That way, you can see where you're going before you get there. create table test (name text, id int, balance numeric (12,2), num float); insert some data... select name, id, balance::float, num::numeric(12,2) into newtable; Now you can check newtable, and if it's right you can then delete the old table and rename newtable in its place.
В списке pgsql-general по дате отправления: