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)