pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Alvaro Herrera <alvherre@2ndquadrant.com>
To: alemagox@gmail.com
Cc: pgsql-bugs@postgresql.org
Subject: Re: BUG #13034: Inconsistent attrelid field in pg_attribute table after adding columns to table.
Date: Mon, 13 Apr 2015 10:25:12 -0300
Message-ID: <20150413132512.GM4369@alvh.no-ip.org> (raw)
In-Reply-To: <20150412115630.26380.58037@wrigleys.postgresql.org>
References: <20150412115630.26380.58037@wrigleys.postgresql.org>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-bugs>

alemagox@gmail.com wrote:

> SELECT format_type(a.atttypid, a.atttypmod) 
>     FROM pg_attribute a 
>         JOIN pg_class b ON (a.attrelid = b.relfilenode)
>         JOIN pg_namespace c ON (c.oid = b.relnamespace)
>     WHERE b.relname = 'test' AND c.nspname = 'ab' AND a.attname = 'id';

pg_attribute.attrelid must be joined to pg_class.oid, not relfilenode.
The relfilenode changes when the table is rewritten, which happens
during some forms of ALTER TABLE and others.

-- 
Álvaro Herrera                http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services


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



view thread (3+ messages)  latest in thread

Message-ID: <20150413132512.GM4369@alvh.no-ip.org>
Permalink:  ../20150413132512.GM4369@alvh.no-ip.org/
Also on:    postgresql.org/message-id/20150413132512.GM4369@alvh.no-ip.org

 · 

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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: alvherre@2ndquadrant.com, alemagox@gmail.com
  Subject: Re: BUG #13034: Inconsistent attrelid field in pg_attribute table after adding columns to table.
  In-Reply-To: <20150413132512.GM4369@alvh.no-ip.org>
  References: <20150412115630.26380.58037@wrigleys.postgresql.org> <20150413132512.GM4369@alvh.no-ip.org>

* 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