pgsql: Fix data-corruption hazard in WAL-logged CREATE DATABASE.

2022-08-06 Thread Tom Lane
Fix data-corruption hazard in WAL-logged CREATE DATABASE. RelationCopyStorageUsingBuffer thought it could skip copying empty pages, but of course that does not work at all, because subsequent blocks will be out of place. Also fix it to acquire share lock on the source buffer. It *might* be safe

pgsql: Fix data-corruption hazard in WAL-logged CREATE DATABASE.

2022-08-06 Thread Tom Lane
Fix data-corruption hazard in WAL-logged CREATE DATABASE. RelationCopyStorageUsingBuffer thought it could skip copying empty pages, but of course that does not work at all, because subsequent blocks will be out of place. Also fix it to acquire share lock on the source buffer. It *might* be safe