I am trying to change the data type of one column in the table from biginteger to varchar.
myproject-# \d+ product_awbstock
Table "public.product_awbstock"
Column | Type | Modifiers | Storage | Description
-------------------+--------------------------+-----------+---------+-------------
airwaybill_number | bigint | not null | plain |
used | boolean | not null | plain |
created | timestamp with time zone | not null | plain |
modified | timestamp with time zone | not null | plain |
Indexes:
"product_awbstock_pkey" PRIMARY KEY, btree (airwaybill_number)
"product_awbstock_used" btree (used)
I am using this query, the error is also given.
alter table product_awbstock ALTER COLUMN airwaybill_number TYPE varchar(15);
ERROR: foreign key constraint "awbstock_id_refs_airwaybill_number_d438187b" cannot be implemented
DETAIL: Key columns "awbstock_id" and "airwaybill_number" are of incompatible types: bigint and character varying.