Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eV5iB-0003GH-GT for pgsql-general@arkaria.postgresql.org; Sat, 30 Dec 2017 01:13:19 +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 1eV5iB-0004Qv-2z for pgsql-general@arkaria.postgresql.org; Sat, 30 Dec 2017 01:13:19 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1eV5iA-0004Qm-Rw for pgsql-general@lists.postgresql.org; Sat, 30 Dec 2017 01:13:18 +0000 Received: from tamriel.snowman.net ([2001:470:e38f::11]) by magus.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1eV5i7-0000qg-UX for pgsql-general@lists.postgresql.org; Sat, 30 Dec 2017 01:13:18 +0000 Received: by tamriel.snowman.net (Postfix, from userid 1000) id 561015F79C; Fri, 29 Dec 2017 20:13:15 -0500 (EST) Date: Fri, 29 Dec 2017 20:13:15 -0500 From: Stephen Frost To: Edson Carlos Ericksson Richter Cc: pgsql-general@lists.postgresql.org Subject: Re: Does PostgreSQL check database integrity at startup? Message-ID: <20171230011315.GC2416@tamriel.snowman.net> References: <20171227213314.GY4628@tamriel.snowman.net> <20171227215204.nucxo7b2ssmyznip@alvherre.pgsql> <20171228121651.GZ4628@tamriel.snowman.net> <42cda197-fead-a7e5-a7e2-750d98bc4eb2@simkorp.com.br> <743808611.5608368.1514484408822@mail.yahoo.com> <20171228182636.GG4628@tamriel.snowman.net> <48a4bcfa-6b85-81ca-9b59-9e47af8fa5af@simkorp.com.br> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="E13BgyNx05feLLmH" Content-Disposition: inline In-Reply-To: <48a4bcfa-6b85-81ca-9b59-9e47af8fa5af@simkorp.com.br> User-Agent: Mutt/1.5.24 (2015-08-30) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk --E13BgyNx05feLLmH Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Greetings, * Edson Carlos Ericksson Richter (richter@simkorp.com.br) wrote: > There should be a "catalog" that point where tables are stored in physical > files (I think, at least, because at some point PostgreSQL need to know from > where to read the data). Yes, it's pg_class. Specifically, the relfilenode. > Based on information from this catalog, would I have a tool (perhaps, a C > function) that check that data is really there? You could write such a function, but it wouldn't be able to be general purpose as a zero-byte file is, in fact, a valid file. You could just as easily do a 'select 1 from table limit 1;' and make sure that you get back a successful, single-row, result, if you wish to verify that certain tables in your database always have at least 1 row. Thanks! Stephen --E13BgyNx05feLLmH Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAEBCgAGBQJaRugrAAoJEO1sijiDR2RVvGcP/2MjDX2Arjjx+GoqHv+WEMU5 rXk24SVUJpAzRtahL/8VNZQsS7JXNanoYWNPJcAedrjBqJ4NbmjKtPzRizZKnTps WVs9wxYJpknlD8Z8xS/54zIRjaWjPeZuyFOe7cqKCKtgpndXe/Pc6y29MtS9qBpV fhHz1jQZDmzbzZc3JoJytgHiWFEgmh1/6Kq46gP0K4pwTJIfOQK1ej/CujyS+fEB ddWZzKL6SMQKCEejypnZo+YzMaXA70LmIFm/5LfAvsGE9OM/RZBAIE9uIatVSlsm R8PYpU0IUQ4awl+GK4ehQeu9BoNeVSUn4n7pyRCGNAgIqNhxF8CVvsIvZnoYB6c6 YFoVSW5sWrc8LUBtmg4REM1mTMqePKi1IDRoLZI+uGXEyPaJ9xUK5dulc20nn6Ce fSbaBqCmW5Ukj4/V/51KtgnldhAH4ROBF88kSss56RAHfn3W45NBJCf6NM/njD4X zg+t5jAMpcLczdMc51jrSTXpeRgNa2phAZgxwPKi0RZLG437XGkaHUNINAcOAAJ6 OsIEEP4O3cfs2ANnZAfBxeTzSiNiMR20oe3rMrsQjZCWcRowCDCADG2cppqtoy80 kW/IoEriUdjqkQ2RbrYPKqVmu8Jp8C153OHb6uU+vKBl/48HiEiMsUZGJKsEeWGg RSPuaZtguOx8zZVtrjjH =5L6G -----END PGP SIGNATURE----- --E13BgyNx05feLLmH--