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 null
 cust_name    | character(50)  | not null
 cust_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
------------
 44444
 43333
 42222
 88888
 54545
 32765
(6 rows)

-- 
Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-sql

Reply via email to