Re: type of a field

From: Keary Suska <hierophant(at)pcisys(dot)net>
To: Postgres-PHP <pgsql-php(at)postgresql(dot)org>
Subject: Re: type of a field
Date: 2002-05-07 16:18:59
Message-ID: B8FD5A93.E203%hierophant@pcisys.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-php

on 5/7/02 7:00 AM, ameen78101(at)yahoo(dot)com 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"

In response to

Browse pgsql-php by date

  From Date Subject
Next Message Christopher Kings-Lynne 2002-05-08 02:09:01 Re: type of a field
Previous Message Scott Marlowe 2002-05-07 15:49:17 Re: type of a field