From: | Stephan Szabo <sszabo(at)megazone23(dot)bigpanda(dot)com> |
---|---|
To: | Oleg Lebedev <oleg(dot)lebedev(at)waterford(dot)org> |
Cc: | "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: Change column type |
Date: | 2003-03-17 17:00:42 |
Message-ID: | 20030317085710.W24325-100000@megazone23.bigpanda.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On Mon, 17 Mar 2003, Oleg Lebedev wrote:
> 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 doubt it. bigint and varchar() don't get stored the same, so I think
that'd only corrupt your table.
> 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?
The types are considered comparable since you can do an equality
comparison on them.
From | Date | Subject | |
---|---|---|---|
Next Message | Ryszard Lach | 2003-03-17 17:30:24 | pg_dump from 7.3 to 7.2 |
Previous Message | Oleg Lebedev | 2003-03-17 16:54:12 | Change column type |