Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eVS29-0007De-C3 for pgsql-general@arkaria.postgresql.org; Sun, 31 Dec 2017 01:03:25 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eVS28-00054d-Be for pgsql-general@arkaria.postgresql.org; Sun, 31 Dec 2017 01:03:24 +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 1eVS27-00054T-TA for pgsql-general@lists.postgresql.org; Sun, 31 Dec 2017 01:03:24 +0000 Received: from tamriel.snowman.net ([2001:470:e38f::11]) by makus.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1eVS20-0005hd-Kf for pgsql-general@lists.postgresql.org; Sun, 31 Dec 2017 01:03:22 +0000 Received: by tamriel.snowman.net (Postfix, from userid 1000) id BC7095F79C; Sat, 30 Dec 2017 20:03:15 -0500 (EST) Date: Sat, 30 Dec 2017 20:03:15 -0500 From: Stephen Frost To: Andreas Joseph Krogh Cc: pgsql-general@lists.postgresql.org Subject: Re: Sv: Re: Sv: Re: Does PostgreSQL check database integrity at startup? Message-ID: <20171231010315.GN2416@tamriel.snowman.net> References: <20171230234931.GM2416@tamriel.snowman.net> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="A2x6GFCQWVc4i5ud" Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.24 (2015-08-30) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk --A2x6GFCQWVc4i5ud Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Greetings Andreas, * Andreas Joseph Krogh (andreas@visena.com) wrote: > Here's a simple test-case: > =A0 > createdb test > test=3D# create table foo(id serial primary key, name varchar not null); > test=3D# CREATE TYPE BigIntTuple2 AS (f1 bigint, f2 bigint); Hah, appears we allocate a relfilenode to types too, though it's not entirely clear to me why (evidently, they're not used..). Anyhow, adding a filter on relkind addresses it (though it's not very future-proof, unfortunately): SELECT quote_ident(nsp.nspname) || '.' || quote_ident(c.relname), s.setting || '/base/' || db.oid || '/' || c.relfilenode, (pg_stat_file(s.setting || '/base/' || db.oid || '/' || c.relfilenode)).s= ize as size FROM=20 pg_settings s=20 JOIN pg_database db on (s.name =3D 'data_directory')=20 JOIN pg_class c on (datname =3D current_database())=20 JOIN pg_namespace nsp on (c.relnamespace =3D nsp.oid)=20 WHERE relfilenode <> 0=20 AND nsp.nspname !~ '^pg_' AND nsp.nspname <> 'information_schema' AND c.relkind in ('r','i','m','p'); Thanks! Stephen --A2x6GFCQWVc4i5ud Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAEBCgAGBQJaSDdTAAoJEO1sijiDR2RVJtkP/iTbepQrXYCxGtG3yjWcl18m pRW+3DnNrOQEIMsZFXYlFOJYiEMFEUoKufE6BwS92QCNGSiRWChXgs8VQZGqbviY FPeNGB808PUb4SjuhYMhUIGGRHOZ94pfJ0w8CDf4+VrpUbiYXOrYBgz9oVi74eFt KiZZlsocNYhatYe4NyZkaKD4/5QwkCP8dgx6JqZcpwUlC6Eh5q2xK6+HsuDFbykC pWaT/2pZ5ha9UUzqQlKsn4KAZkBC5hiYLj8adY1AyxmRd8QMsvQ8s8MvgiD93itj NI7VNT6AYKSyaHbXs1WT4ZEEcHr4RNBFdwwJfRnTLngUzOeZ8uxQ+rQR1hKVNlKm bbGhmc6eawzs68gPelvwmc9JMrAzKsK8yLL/9+iEhmXJkpi2nvudIqVeOcSEeG9A L4pV0EvyoVb4hFN4ZzbSGFxowl0l0pvJZUhiI0h4heVusjECPT2jxxbt9zrFb2Xv CDBuQ381r+ghdzqgSJdm1iXTmdcvC8ule4sAbXdEF3SsaCH5o2vRXLNmBzZphpmI ajaxWTyRQW98EGiMBpksSa3RLSQcA75b0yNfUA3bB6Wj9B3Uoiwu2Abyv3mGcYHQ dkNFgPfTpYxwTtGwIxFo7a3cslhDBlHiRSbnCvQaqzajmHgPIPCp0Lo3EvIBZmmz bxYFsr7foCCTuyRXIURQ =CssR -----END PGP SIGNATURE----- --A2x6GFCQWVc4i5ud--