pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Justin Pryzby <pryzby@telsasoft.com>
Cc: Robert Haas <robertmhaas@gmail.com>
Cc: pgsql-hackers@postgresql.org <pgsql-hackers@postgresql.org>
Subject: Re: ALTER TABLE .. ALTER COLUMN .. ERROR: attribute .. has wrong type
Date: Tue, 03 Jan 2017 16:26:42 -0500
Message-ID: <24903.1483478802@sss.pgh.pa.us> (raw)
In-Reply-To: <20170103205423.GW32031@telsasoft.com>
References: <20170103165903.GP32031@telsasoft.com>
	<CA+TgmobAT992nxV=6kqnpF=LK493oNdf2dzXJX-Yz+=LWZ-_AA@mail.gmail.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>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-hackers>

Justin Pryzby <pryzby@telsasoft.com> 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=# SELECT attrelid::regclass, attname, attnum, atttypid FROM pg_attribute WHERE attrelid::regclass::text~'eric_umts_rnc_utrancell_(metrics|201701)$' AND (attname='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


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers



view thread (27+ messages)  latest in thread

Message-ID: <24903.1483478802@sss.pgh.pa.us>
Permalink:  ../24903.1483478802@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/24903.1483478802@sss.pgh.pa.us

 · 

reply

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-hackers@postgresql.org
  Cc: tgl@sss.pgh.pa.us, pryzby@telsasoft.com, robertmhaas@gmail.com
  Subject: Re: ALTER TABLE .. ALTER COLUMN .. ERROR: attribute .. has wrong type
  In-Reply-To: <24903.1483478802@sss.pgh.pa.us>

* 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