Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cOWba-0005sb-AN for pgsql-hackers@arkaria.postgresql.org; Tue, 03 Jan 2017 21:26:50 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1cOWbZ-00041w-Ck for pgsql-hackers@arkaria.postgresql.org; Tue, 03 Jan 2017 21:26:49 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1cOWbY-000412-4X for pgsql-hackers@postgresql.org; Tue, 03 Jan 2017 21:26:48 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1cOWbV-0006JW-HL for pgsql-hackers@postgresql.org; Tue, 03 Jan 2017 21:26:46 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id v03LQgHb024904; Tue, 3 Jan 2017 16:26:42 -0500 From: Tom Lane To: Justin Pryzby cc: Robert Haas , "pgsql-hackers@postgresql.org" Subject: Re: ALTER TABLE .. ALTER COLUMN .. ERROR: attribute .. has wrong type In-reply-to: <20170103205423.GW32031@telsasoft.com> References: <20170103165903.GP32031@telsasoft.com> <20170103185742.GQ32031@telsasoft.com> <28476.1483471956@sss.pgh.pa.us> <20170103194604.GR32031@telsasoft.com> <29101.1483473021@sss.pgh.pa.us> <20170103195709.GT32031@telsasoft.com> <30539.1483474695@sss.pgh.pa.us> <20170103202919.GU32031@telsasoft.com> <31170.1483475734@sss.pgh.pa.us> <20170103205423.GW32031@telsasoft.com> Comments: In-reply-to Justin Pryzby message dated "Tue, 03 Jan 2017 14:54:23 -0600" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <24902.1483478802.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Tue, 03 Jan 2017 16:26:42 -0500 Message-ID: <24903.1483478802@sss.pgh.pa.us> X-Pg-Spam-Score: -5.1 (-----) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org Justin Pryzby writes: > On Tue, Jan 03, 2017 at 03:35:34PM -0500, Tom Lane wrote: >> Right. So I bet that if you check the attnum of pmsumpacketlatency_000 = in >> eric_umts_rnc_utrancell_metrics, you'll find it's different from that in >> eric_umts_rnc_utrancell_201701, and that the attribute having that attnum >> in eric_umts_rnc_utrancell_201701 has type smallint not int. > I think that's consistent with what your understanding: > ts=3D# SELECT attrelid::regclass, attname, attnum, atttypid FROM pg_attri= bute WHERE attrelid::regclass::text~'eric_umts_rnc_utrancell_(metrics|20170= 1)$' AND (attname=3D'pmsumpacketlatency_000' OR attnum IN (367,424) ) ORDER= BY 1,2; > eric_umts_rnc_utrancell_metrics | pmsamplespshsadchrabestablish | 367= | 21 > eric_umts_rnc_utrancell_metrics | pmsumpacketlatency_000 | 424= | 23 > eric_umts_rnc_utrancell_201701 | pmsumpacketlatency_000 | 367= | 23 > eric_umts_rnc_utrancell_201701 | pmulupswitchsuccessmedium | 424= | 21 Yup. So if you can't wait for a fix, your best bet would be to dump and reload these tables, which should bring their attnums back in sync. (Of course, they might not stay that way for long, if you're also in the habit of adding columns often.) regards, tom lane --=20 Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers