Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cOSRy-0000lu-1E for pgsql-hackers@arkaria.postgresql.org; Tue, 03 Jan 2017 17:00:38 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1cOSRx-0005gd-Cc for pgsql-hackers@arkaria.postgresql.org; Tue, 03 Jan 2017 17:00:37 +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 1cOSQW-0003jd-W0 for pgsql-hackers@postgresql.org; Tue, 03 Jan 2017 16:59:09 +0000 Received: from mail-it0-x22d.google.com ([2607:f8b0:4001:c0b::22d]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.84_2) (envelope-from ) id 1cOSQT-0000DM-Rm for pgsql-hackers@postgresql.org; Tue, 03 Jan 2017 16:59:07 +0000 Received: by mail-it0-x22d.google.com with SMTP id x2so301661714itf.1 for ; Tue, 03 Jan 2017 08:59:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=telsasoft-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=R2uOqCvhQ3bI0Q5fIjMu8xyi9iovfsQt/WnOE2tz9l8=; b=RvBqwZEQrPZ3Py5sNeDoQcAF+K0JFt9M3oPyaL2sBXTI8U8BZf6zzTDEIO5F5WgunJ 3ly1guodW1l08TzQEq4uK4c6d2ZJcQHEMdPNm5emsAHupGleQX+qS0MwApdx+2/L8o7W y2cSlngzeMBSG0Px1mU5FUsKSZXP0c8Z4Ro93oHdYF/FkMBdOuhzkYGnVfUESO/1md+D Cfd9gdj0ygPVz+4TYe4jlo54E/63g/0UD+7uxURFuoGNow0iDv+ITpC1EetQxQKhq7En 9vTIcD/jeTGtaeNi+54i6P1MhaF8hRInRI0fMHEkHo8kUM3hYRc9PoW59BZtPPCPBJHY MuZQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=R2uOqCvhQ3bI0Q5fIjMu8xyi9iovfsQt/WnOE2tz9l8=; b=bmXyyr8V228aAgGovJ/OOXDK1/wPYtJm+92nYf4QgdsRetN4LffvYjs9N0WKG1/20d hBjRsc8zPh7P0lAH+2dqYZfXofv9l4JMgaoxRNH+LrcJBTaHfoJp9rQWstHYlooFlk6l GkyhDs2Uq40ysFYlVi5Btf1vBsLzcV1mXDQO8buFLesnVATj+bnWCaqkGcFCpmzdnHwP EfyzuOlRGqfgclzuETwUR72LyICsDFPJgz+NJHYSzgkuGY+yHqgmRJalDqsncLvHCwlb LKDIzUOngd/j1KTaxYn+5At0Zq+tVAoBilouNSxH3bGBBVcuc6CLh6eyUi3v12wPLPX5 Ltvw== X-Gm-Message-State: AIkVDXLqcjA/EFyznM18nj0AK+quILiSUVjl1/ZPw3n3XJGV1h8YbXOliHxnU71DTzO/wA== X-Received: by 10.36.68.146 with SMTP id o140mr52095691ita.33.1483462744991; Tue, 03 Jan 2017 08:59:04 -0800 (PST) Received: from pryzbyj (charmander.telsasoft.com. [50.244.222.1]) by smtp.gmail.com with ESMTPSA id m128sm21175989itm.16.2017.01.03.08.59.04 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 03 Jan 2017 08:59:04 -0800 (PST) Received: by pryzbyj (Postfix, from userid 1000) id B402A8014DC; Tue, 3 Jan 2017 10:59:03 -0600 (CST) Date: Tue, 3 Jan 2017 10:59:03 -0600 From: Justin Pryzby To: Robert Haas Cc: "pgsql-hackers@postgresql.org" Subject: Re: ALTER TABLE .. ALTER COLUMN .. ERROR: attribute .. has wrong type Message-ID: <20170103165903.GP32031@telsasoft.com> References: <20161012152505.GD12747@telsasoft.com> <20170102225618.GA10071@telsasoft.com> <20170103003240.GM32031@telsasoft.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.23 (2014-03-12) X-Pg-Spam-Score: -2.6 (--) 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 On Tue, Jan 03, 2017 at 11:45:33AM -0500, Robert Haas wrote: > > ts=# begin; drop view umts_eric_ch_switch_view, eric_umts_rnc_utrancell_view, umts_eric_cell_integrity_view; ALTER TABLE eric_umts_rnc_utrancell_metrics ALTER COLUMN PMSUMPACKETLATENCY_000 TYPE BIGINT USING PMSUMPACKETLATENCY_000::BIGINT; > > BEGIN > > DROP VIEW > > ERROR: attribute 424 has wrong type > > DETAIL: Table has type smallint, but query expects integer. > > ts=# > > > > ts=# begin; drop view umts_eric_ch_switch_view, eric_umts_rnc_utrancell_view, umts_eric_cell_integrity_view; ALTER TABLE eric_umts_rnc_utrancell_metrics ALTER COLUMN PMSUMPACKETLATENCY_000 TYPE BIGINT ; > > BEGIN > > DROP VIEW > > ALTER TABLE > > ts=# > > > > Is it useful to send something from pg_attribute, or other clues ?? > > So, are these errors reproducible? Like, if you create a brand new I can cause the error at will on the existing table, but I wouldn't know how to reproduce the problem on a new table/database. I'm guessing it has something to do with dropped columns or historic alters (which I mentioned are typically done separately on child tables vs their parent). Since it's happened 3 times now on this table, but not others on this database, I would guess it's an "data issue", possibly related to pg_upgrades. IOW it may be impossible to get into this state from a fresh initdb from a current version. I considered that perhaps it only affected our oldest tables, and would stop happening once they were dropped, but note this ALTER is only of a parent and its 3 most recent children. So only the empty parent could be described as "old". Justin -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers