Unable To Alter Data Type - Mailing list pgsql-sql

From Carlos Mennens
Subject Unable To Alter Data Type
Date
Msg-id CAAQLLO5aXWj=Ss+9rKyohWcnb3Fnm2k_pAQu_pDfL=76VrbHzQ@mail.gmail.com
Whole thread Raw
Responses Re: Unable To Alter Data Type  ("David Johnston" <polobo@yahoo.com>)
List pgsql-sql
I have an issue I can't figure out. I have the following TABLE:


tysql=# \d customers        Table "public.customers"   Column    |      Type      | Modifiers
--------------+----------------+-----------cust_id      | character(10)  | not nullcust_name    | character(50)  | not
nullcust_address| character(50)  |cust_city    | character(50)  |cust_state   | character(5)   |cust_zip     |
character(10) |cust_country | character(50)  |cust_contact | character(50)  |cust_email   | character(255) |
 
Indexes:   "customers_pkey" PRIMARY KEY, btree (cust_id)
Referenced by:   TABLE "orders" CONSTRAINT "fk_orders_customers" FOREIGN KEY
(cust_id) REFERENCES customers(cust_id)

Now I'm attempting to ALTER the field 'cust_zip' TYPE from character
to integer however I'm getting the following error:

tysql=# ALTER TABLE customers ALTER COLUMN cust_zip TYPE bigint;
ERROR:  column "cust_zip" cannot be cast to type bigint

I thought perhaps the stored data in the field conflicted with the
data type but I can't see why:

tysql=# SELECT cust_zip FROM customers; cust_zip
------------444444333342222888885454532765
(6 rows)


pgsql-sql by date:

Previous
From: Tom Lane
Date:
Subject: Re: amount of join's and sequential access to the tables involved
Next
From: "David Johnston"
Date:
Subject: Re: Unable To Alter Data Type