From: Ian Barwick <ian@2ndquadrant.com>
To: Ankur Kaushik <ankurkaushik@gmail.com>
To: pgsql-admin <pgsql-admin@postgresql.org>
Subject: Re: changing varchar to int
Date: Thu, 23 Jul 2015 18:41:02 +0900
Message-ID: <55B0B6AE.7060905@2ndquadrant.com> (raw)
In-Reply-To: <CALXoLqyfmWre=DC3yifOUJPtUK4vV+7LDSZzHk6ocZP1rv3rsg@mail.gmail.com>
References: <CALXoLqyfmWre=DC3yifOUJPtUK4vV+7LDSZzHk6ocZP1rv3rsg@mail.gmail.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-admin>
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@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-admin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-admin@postgresql.org
Cc: ian@2ndquadrant.com, ankurkaushik@gmail.com
Subject: Re: changing varchar to int
In-Reply-To: <55B0B6AE.7060905@2ndquadrant.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox