Skip to content

Commit acc8e41

Browse files
committed
pg_upgrade: compare control version, not catalog version
Also modify test for the possibility the large object value might not exist in the old cluster. Fix for commit e1598a1
1 parent e1598a1 commit acc8e41

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

contrib/pg_upgrade/controldata.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -488,7 +488,7 @@ get_control_data(ClusterInfo *cluster, bool live_check)
488488
!got_align || !got_blocksz || !got_largesz || !got_walsz ||
489489
!got_walseg || !got_ident || !got_index || !got_toast ||
490490
(!got_large_object &&
491-
cluster->controldata.cat_ver >= LARGE_OBJECT_SIZE_PG_CONTROL_VER) ||
491+
cluster->controldata.ctrl_ver >= LARGE_OBJECT_SIZE_PG_CONTROL_VER) ||
492492
!got_date_is_int || !got_float8_pass_by_value || !got_data_checksum_version)
493493
{
494494
pg_log(PG_REPORT,
@@ -542,7 +542,7 @@ get_control_data(ClusterInfo *cluster, bool live_check)
542542
pg_log(PG_REPORT, " maximum TOAST chunk size\n");
543543

544544
if (!got_large_object &&
545-
cluster->controldata.cat_ver >= LARGE_OBJECT_SIZE_PG_CONTROL_VER)
545+
cluster->controldata.ctrl_ver >= LARGE_OBJECT_SIZE_PG_CONTROL_VER)
546546
pg_log(PG_REPORT, " large-object chunk size\n");
547547

548548
if (!got_date_is_int)
@@ -594,7 +594,9 @@ check_control_data(ControlData *oldctrl,
594594
if (oldctrl->toast == 0 || oldctrl->toast != newctrl->toast)
595595
pg_fatal("old and new pg_controldata maximum TOAST chunk sizes are invalid or do not match\n");
596596

597-
if (oldctrl->large_object == 0 || oldctrl->large_object != newctrl->large_object)
597+
/* large_object added in 9.5, so it might not exist in the old cluster */
598+
if (oldctrl->large_object != 0 &&
599+
oldctrl->large_object != newctrl->large_object)
598600
pg_fatal("old and new pg_controldata large-object chunk sizes are invalid or do not match\n");
599601

600602
if (oldctrl->date_is_int != newctrl->date_is_int)

0 commit comments

Comments
 (0)