Re: changing varchar to int

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 15/07/23 16:27, Ankur Kaushik wrote:
> Original column
> 
> 
> 
> Column                   Type                                 Modifiers
> model                | character varying(50)       | default NULL::character varying
> 
> 
> Required Column
> 
> Model                   integer
> 
> 
> =========
> ALTER TABLE device ALTER COLUMN model TYPE integer USING (model::integer);
> 
> 
> getting below error
> 
> ERROR:  default for column "model" cannot be cast automatically to type integer

You'll need to drop the column default and re-add it after converting the
column.


Regards

Ian Barwick

-- 
 Ian Barwick                   http://www.2ndQuadrant.com/
 PostgreSQL Development, 24x7 Support, RemoteDBA, Training & Services


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



[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux