CREATE DATABASE ... TEMPLATE ... vs checksums - Mailing list pgsql-general

From Karsten Hilbert
Subject CREATE DATABASE ... TEMPLATE ... vs checksums
Date
Msg-id 20190603100331.GB6162@hermes.hilbert.loc
Whole thread Raw
List pgsql-general
The application I am working on is doing database upgrades by
cloning the previous release into a new database by means of

    CREATE DATABASE new_one TEMPLATE old_one ...;

(health care, extremely conservative, contingency: can switch
back to still existing old database with old client at any
time without delay).

For good measure, appropriate REINDEX / ANALYZE / VALIDATE
CONSTRAINTS are applied judiciously. Now I wondered how to
include a checksum verification step.

Before the advent of pg_(verify_)checksums the canonical way
to test checksums online (if enabled) was to do a dump of the
objects desired to be checked, if I am informed correctly.
The rationale being that for dumping an object it will need
to be read, and consequently CRCs are being checked.

So I was wondering whether creating a database from a
template also does that. I assume it does not because likely
that's a file level copy operation rather than a semantic
data read, correct ?

If so (that is: not), should there be a way of saying

    CREATE DATABASE new_one TEMPLATE old_one ... VERIFY_CRC;

Likely, this proposal won't go very far since we can already
see an explicit (online) SQL command

    select pg_verify_checksums(object);

on the horizon, right ?

So, for the time being, my only option would be to include a
pg_dump step of the template before cloning it ?

Thanks for insights shared,
Karsten
--
GPG  40BE 5B0E C98E 1713 AFA6  5BC0 3BEA AC80 7D4F C89B



pgsql-general by date:

Previous
From: Daulat Ram
Date:
Subject: Cause: org.postgresql.util.PSQLException: ERROR: could not resizeshared memory segment "/PostgreSQL.1946998112" to 8388608 bytes: No spaceleft on device
Next
From: Morris de Oryx
Date:
Subject: Re: Questions about btree_gin vs btree_gist for low cardinality columns