Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1ZID05-0007wI-Sj for pgsql-admin@arkaria.postgresql.org; Thu, 23 Jul 2015 09:41:13 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84) (envelope-from ) id 1ZID05-0008Pf-EP for pgsql-admin@arkaria.postgresql.org; Thu, 23 Jul 2015 09:41:13 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84) (envelope-from ) id 1ZID04-0008PO-Un for pgsql-admin@postgresql.org; Thu, 23 Jul 2015 09:41:13 +0000 Received: from mail-pa0-f54.google.com ([209.85.220.54]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.84) (envelope-from ) id 1ZID01-00035G-5P for pgsql-admin@postgresql.org; Thu, 23 Jul 2015 09:41:12 +0000 Received: by padck2 with SMTP id ck2so154324394pad.0 for ; Thu, 23 Jul 2015 02:41:05 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-type :content-transfer-encoding; bh=XqJBO2VqGwS/UaNeB338ceTp43Y0ok1bBBgm3zlaOv0=; b=GJHm5VJbAwtMbZeh0nifgq6VmJHU3opd11j4ScxNepb9sKgXZLjvxqcsZo4JYw9qLX 3D+EWaDadolImF4jq/maOZwAgDlavpWVhgxQmPWWmtP1D5CjVqEfQLo6AxFHU52UaE+d qU+LAZuJRBGPO/+2PuCxHAszKee4SlBfxRl7p4ZRnryG/w1zxpqwUn1iofMGcAnZr6Ha QYgrR9lRK68M3gdiuAdnuqqCvcpL0WwQQ24lKmRnQ9mFksFAjHTI6/xev7uMPC5U43YQ GR49ird8unLiZU2L2PNrjnwpeoMAIrQ4N645rFW9odKKVftmkfN7M0CHP3caPvJLK6gV sWkA== X-Gm-Message-State: ALoCoQlo/SUNMAOPYKdrGmIC+UR/0tUBh9Ts6FmX8FWli0j4+742fxii7xuALBwTr6ZX4T2uYgIsgX1EeVlLtXsymjxmGz9QGMS29Aa3ZoCpORfUQIFp491bpCfndSu1cK88yJKcvnAka5vjfQEmUMOEfwWXDZ/KKLvxHRoMMtfeuNXrtpa/MK2RFoPJ243ywujrC1H8wmiw X-Received: by 10.70.89.109 with SMTP id bn13mr7765113pdb.163.1437644465694; Thu, 23 Jul 2015 02:41:05 -0700 (PDT) Received: from nara.local (ai126165011128.3.access-internet.ne.jp. [126.165.11.128]) by smtp.gmail.com with ESMTPSA id ky17sm7900388pab.31.2015.07.23.02.41.04 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 23 Jul 2015 02:41:05 -0700 (PDT) Subject: Re: changing varchar to int To: Ankur Kaushik , pgsql-admin References: From: Ian Barwick Message-ID: <55B0B6AE.7060905@2ndquadrant.com> Date: Thu, 23 Jul 2015 18:41:02 +0900 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:38.0) Gecko/20100101 Thunderbird/38.1.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Pg-Spam-Score: -2.6 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-admin Precedence: bulk Sender: pgsql-admin-owner@postgresql.org 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