agora inbox for pgsql-sql@postgresql.org  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Sebastien FLAESCH <sf@4js.com>
Cc: pgsql-sql@postgresql.org
Subject: Re: TRUNCATE TABLE corrupts pg_class.relfilenode = pg_attrdef.pg_attrdef
Date: Mon, 22 May 2017 08:04:23 -0400
Message-ID: <64541.1495454663@sss.pgh.pa.us> (raw)
In-Reply-To: <66def74b-633e-65a0-cf44-4d486f15ebd9@4js.com>
References: <66def74b-633e-65a0-cf44-4d486f15ebd9@4js.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-sql>

Sebastien FLAESCH <sf@4js.com> writes:
> It is normal that a TRUNCATE TABLE statement changes the table/sequence relation in pg_attrdef?

It is normal for TRUNCATE, as well as several other kinds of DDL, to
change relfilenode.

> test1=> select a.adsrc from pg_class p join pg_attrdef a on (p.relfilenode = a.adrelid) where lower(p.relname) = lower('mytab');

This query is simply wrong; the join column should be p.oid.  See the
system catalog definitions,

https://www.postgresql.org/docs/current/static/catalogs.html

			regards, tom lane


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



view thread (5+ messages)

Message-ID: <64541.1495454663@sss.pgh.pa.us>
Permalink:  ../64541.1495454663@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/64541.1495454663@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-sql@postgresql.org
  Cc: tgl@sss.pgh.pa.us, sf@4js.com
  Subject: Re: TRUNCATE TABLE corrupts pg_class.relfilenode = pg_attrdef.pg_attrdef
  In-Reply-To: <64541.1495454663@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 agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox