Change column type

From: Oleg Lebedev <oleg(dot)lebedev(at)waterford(dot)org>
To: "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Change column type
Date: 2003-03-17 16:54:12
Message-ID: 993DBE5B4D02194382EC8DF8554A5273113E45@postoffice.waterford.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

I want to change a column type from VARCHAR to BIGINT. All values
currently stored in the column are integers. Saving column data,
recreating the column and restoring data seems to be too convoluted.
Besides, I have multiple constraints declared on this column, which I
will have to recreate once the column is dropped. I wonder if the
easiest way to do this would be just to change the atttypid in
pg_attribute?

I also wonder why it is possible to declare an FK constraint on a column
of type VARCHAR to reference a PK column of type BIGINT?

Thanks.

Oleg

*************************************

This email may contain privileged or confidential material intended for the named recipient only.
If you are not the named recipient, delete this message and all attachments.
Any review, copying, printing, disclosure or other use is prohibited.
We reserve the right to monitor email sent through our network.

*************************************

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Stephan Szabo 2003-03-17 17:00:42 Re: Change column type
Previous Message Dmitry Tkach 2003-03-17 16:44:46 Re: newbie question