Unable To Alter Data Type

Поиск
Список
Период
Сортировка
От Carlos Mennens
Тема Unable To Alter Data Type
Дата
Msg-id CAAQLLO5aXWj=Ss+9rKyohWcnb3Fnm2k_pAQu_pDfL=76VrbHzQ@mail.gmail.com
обсуждение исходный текст
Ответы Re: Unable To Alter Data Type
Список 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 по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: amount of join's and sequential access to the tables involved
Следующее
От: "David Johnston"
Дата:
Сообщение: Re: Unable To Alter Data Type