Re: [SQL] TRUNCATE TABLE corrupts pg_class.relfilenode = pg_attrdef.pg_attrdef - Mailing list pgsql-sql

From Tom Lane
Subject Re: [SQL] TRUNCATE TABLE corrupts pg_class.relfilenode = pg_attrdef.pg_attrdef
Date
Msg-id 64541.1495454663@sss.pgh.pa.us
Whole thread Raw
In response to [SQL] TRUNCATE TABLE corrupts pg_class.relfilenode = pg_attrdef.pg_attrdef  (Sebastien FLAESCH <sf@4js.com>)
List pgsql-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



pgsql-sql by date:

Previous
From: Sebastien FLAESCH
Date:
Subject: Re: [SQL] TRUNCATE TABLE corrupts pg_class.relfilenode =pg_attrdef.pg_attrdef
Next
From: "Eliober Cleger Despaigne"
Date:
Subject: [SQL] about LEFT and INNER JOIN