Re: Modyifying a column's datatype
От | Jeff Eckermann |
---|---|
Тема | Re: Modyifying a column's datatype |
Дата | |
Msg-id | 20030903225532.61229.qmail@web20803.mail.yahoo.com обсуждение исходный текст |
Ответ на | Re: Modyifying a column's datatype (Ron Johnson <ron.l.johnson@cox.net>) |
Ответы |
Re: Modyifying a column's datatype
|
Список | pgsql-novice |
--- Ron Johnson <ron.l.johnson@cox.net> wrote: > On Wed, 2003-09-03 at 14:56, Louise Cofield wrote: > > Greetings � > > > > > > > > It looks to me as if there is no way to alter the > datatype of a table > > column, as in from timestamp to varchar. Am I > right? (I will cry if > > I�m right.) L. > > > > It appears that I must drop and then re-create the > table structure, > > with my new column datatype, in order to keep the > columns in the > > current order � true? > > There are references to this all throughout the > archives. > > begin; > alter table foo add column bar varchar; > update foo set bar = cast(sniffle as varchar); > alter table foo drop column sniffle; > alter table foo rename column bar to sniffle; > commit; I don't believe that this will preserve the column order, which the OP wanted. The only alternative that I know of is to hack the system tables, but that is definitely risky. Column order is not supposed to matter, but it is amazing how many (brain dead) applications there are that rely on it. __________________________________ Do you Yahoo!? Yahoo! SiteBuilder - Free, easy-to-use web site design software http://sitebuilder.yahoo.com
В списке pgsql-novice по дате отправления: