Re: type of a field

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



on 5/7/02 7:00 AM, ameen78101@xxxxxxxxx purportedly said:

> I want to change the type of a field in postgres .
> How can I do it ?

You can't, at least not exactly. I believe there is some info in either the
FAQ, documentation, or non-FAQ documentation on the Postgres site.

In essence, your choices are:

1) recreate the field: rename the current field, then create a new field
with the same name and desired options; or

2) recreate the table: rename the current table, create a new table with the
proper name and field definitions as desired, drop the old table. You can
use SELECT INTO to transfer data from the old table to new.

In both cases, however, you can run into problems with triggers and other
server-side functions that use the field or table. I believe there are ways
around this, but I don't recall them at the moment.

Keary Suska
Esoteritech, Inc.
"Leveraging Open Source for a better Internet"



[Index of Archives]     [Postgresql General]     [Postgresql Admin]     [PHP Users]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Databases]     [Yosemite Backpacking]     [Postgresql Jobs]

  Powered by Linux