Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cOD3O-00038L-Ou for pgsql-hackers@arkaria.postgresql.org; Tue, 03 Jan 2017 00:34:14 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1cOD3O-0007j3-By for pgsql-hackers@arkaria.postgresql.org; Tue, 03 Jan 2017 00:34:14 +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 1cOD1y-0005v4-Ou for pgsql-hackers@postgresql.org; Tue, 03 Jan 2017 00:32:47 +0000 Received: from mail-it0-x229.google.com ([2607:f8b0:4001:c0b::229]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.84_2) (envelope-from ) id 1cOD1v-0007No-NA for pgsql-hackers@postgresql.org; Tue, 03 Jan 2017 00:32:45 +0000 Received: by mail-it0-x229.google.com with SMTP id o141so265012592itc.0 for ; Mon, 02 Jan 2017 16:32:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=telsasoft-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=0cdcXbO3d7SdRunvY8Fse5bGm2WsuaaBe+4LyVgL8Nc=; b=0kxUPTuE0x2Z356Gsiq4qYcPU2BW/iiXcbWWdjzQ+P1H7uzKx07CJJ6TXEUxRGnlvh TT1s50XFbkoQMA512eded2sWTqA+cgYZ/hygW56MLoIYdRcYUHApOaTDp8vzzZq2cyK5 NRZpHmYF1ZDRbe46TK0+uAPhLeJoCH33MzuhEywbJOBtX2OJmOA++ar+WA3Lx2exJ9lc DfGmrVXCtNjIFAhjhDur+WyMddFaD5/+QBTLwMeOLsbBUTJiCnaar1RqcKIc2gN4xNsF Qid7lOalMLB3CEds/2L5Fyyn/1EH0YFjfJKw25PvhAizEmHDVCVNTpjrjUh9OdZpsWa9 HYRQ== 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:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=0cdcXbO3d7SdRunvY8Fse5bGm2WsuaaBe+4LyVgL8Nc=; b=VZmyhDkCJjK8IaB1g04KYLQMVcv7RsiUz70RQaxHcxqEFksrFLXzzcUg9ewlFrJIs+ VQVYaEjhqRKjlFDejUmYQfAiWglfuFQiKmsQLvmkm/NceX8F7d2mODO8g+cBoKiTSCZk O7mCk8vCwYS0J/L6m39bNTAP+BJOp4PU+mtqytJp+8/DTm/zkApbLGmB6cVWIRsxaTsa 0cY2z0I1T6QsEOi/wpvIoKi36nZx7ncExZnJ6LysxZ0J5w0f4yraAbmQ9OlVznhDtBVU XA8KRbKlLk+sLsr6LTnZjc1EvrizUlwoFdGzwF2DL5cbpLQqTK9rjxQpmpJ0lo/nBkzZ juMw== X-Gm-Message-State: AIkVDXLIXjQ/p3Vj/b0ShFtrlFG0RM3zxWAMkiVN3PDCThBrdEHn26ZTxZxuoAAWlwxlYQ== X-Received: by 10.36.29.21 with SMTP id 21mr48617500itj.80.1483403561800; Mon, 02 Jan 2017 16:32:41 -0800 (PST) Received: from pryzbyj (charmander.telsasoft.com. [50.244.222.1]) by smtp.gmail.com with ESMTPSA id g130sm23702171ita.10.2017.01.02.16.32.41 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 02 Jan 2017 16:32:41 -0800 (PST) Received: by pryzbyj (Postfix, from userid 1000) id 385BE8014DD; Mon, 2 Jan 2017 18:32:40 -0600 (CST) Date: Mon, 2 Jan 2017 18:32:40 -0600 From: Justin Pryzby To: pgsql-hackers@postgresql.org Subject: Re: ALTER TABLE .. ALTER COLUMN .. ERROR: attribute .. has wrong type Message-ID: <20170103003240.GM32031@telsasoft.com> References: <20161012152505.GD12747@telsasoft.com> <20170102225618.GA10071@telsasoft.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20170102225618.GA10071@telsasoft.com> User-Agent: Mutt/1.5.23 (2014-03-12) X-Pg-Spam-Score: -1.9 (-) 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 Wed, Oct 12, 2016 at 10:25:05AM -0500, Justin Pryzby wrote: > > I don't have a clear recollection how I solved this in July; possibly by > > restoring the (historic, partition) table from backup. > > > > Last week again again just now (both under 9.6), a colleague found that he was > > able to avoid the error by ALTER TYPE without USING. > > > > Note that we ALTER TABLE .. NO INHERIT the partitions for all but the most > > recent 2 months before ALTERing them (or the parent). The "ALTER NO INHERIT" > > and the ALTER TYPE of historic partitions are done outside of a transaction in > > order to avoid large additional disk use otherwise used when ALTERing a parent > > with many or large children (the sum of the size of the children). Here's DETAILs for a 2nd such error which has shown up today: (EricssonUtranXmlParser): Failed to alter table eric_umts_rnc_utrancell_metrics: ERROR: attribute 424 has wrong type DETAIL: Table has type smallint, but query expects integer. (EricssonUtranXmlParser): Failed to alter table eric_umts_rnc_utrancell_metrics: ERROR: attribute 361 has wrong type DETAIL: Table has type integer, but query expects smallint. Also, note both alters really do work without "USING": 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 ?? -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers