Skip to content

Commit 6393e80

Browse files
authored
Handle checksums enabled in initdb by default (#1179)
1 parent e44bdf8 commit 6393e80

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

postgres-appliance/major_upgrade/pg_upgrade.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -207,8 +207,9 @@ def prepare_new_pgdata(self, version):
207207
locale = self.query("SELECT datcollate FROM pg_database WHERE datname='template1';")[0][0]
208208
encoding = self.query('SHOW server_encoding')[0][0]
209209
initdb_config = [{'locale': locale}, {'encoding': encoding}]
210-
if self.query("SELECT current_setting('data_checksums')::bool")[0][0]:
211-
initdb_config.append('data-checksums')
210+
checksums_enabled = self.query("SELECT current_setting('data_checksums')::bool")[0][0]
211+
if checksums_enabled == (int(version) < 18):
212+
initdb_config.append('data-checksums' if checksums_enabled else 'no-data-checksums')
212213

213214
logger.info('initdb config: %s', initdb_config)
214215

0 commit comments

Comments
 (0)