Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dCm5r-0002yB-13 for pgsql-sql@arkaria.postgresql.org; Mon, 22 May 2017 12:05:47 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1dCm5q-0006kF-Jm for pgsql-sql@arkaria.postgresql.org; Mon, 22 May 2017 12:05:46 +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 1dCm4p-0004sa-1j for pgsql-sql@postgresql.org; Mon, 22 May 2017 12:04:43 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1dCm4m-0001PI-06 for pgsql-sql@postgresql.org; Mon, 22 May 2017 12:04:41 +0000 Received: from pro.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id v4MC4OrX022304; Mon, 22 May 2017 08:04:25 -0400 From: Tom Lane To: Sebastien FLAESCH cc: pgsql-sql@postgresql.org Subject: Re: TRUNCATE TABLE corrupts pg_class.relfilenode = pg_attrdef.pg_attrdef In-reply-to: <66def74b-633e-65a0-cf44-4d486f15ebd9@4js.com> References: <66def74b-633e-65a0-cf44-4d486f15ebd9@4js.com> Comments: In-reply-to Sebastien FLAESCH message dated "Mon, 22 May 2017 12:51:27 +0200" Date: Mon, 22 May 2017 08:04:23 -0400 Message-ID: <64541.1495454663@sss.pgh.pa.us> X-Pg-Spam-Score: -1.9 (-) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-sql Precedence: bulk Sender: pgsql-sql-owner@postgresql.org Sebastien FLAESCH 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