Skip to content

Commit 64152f3

Browse files
authored
spock upgrade: check all possible true guc values when verifying AutoDDL is off (#391)
1 parent 929c633 commit 64152f3

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

cli/scripts/util.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,13 @@ def get_guc_value(pg_comp, guc_name):
195195
return None
196196

197197
return None
198-
198+
199+
def guc_value_as_bool(guc_value):
200+
# https://www.postgresql.org/docs/current/datatype-boolean.html
201+
if guc_value is not None and guc_value.strip().lower() in ("on","true", "yes", "y", "1", "t", "tr", "tru", "ye"):
202+
return True
203+
return False
204+
199205
# Match both "spock50" and "spock50-pg17" (and variants like spock5, spock5-pg16)
200206
_SPOCK5_NAME_RE = re.compile(r"^spock5(?:0)?(?:-pg\d+)?$", re.IGNORECASE)
201207
_SPOCK5_VER_RE = re.compile(r"^5\.", re.IGNORECASE)
@@ -256,7 +262,7 @@ def validate_spock_upgrade(spock_component):
256262
"spock.enable_ddl_replication",
257263
]:
258264
val = get_guc_value(existing_pg_comp, guc)
259-
if val == "on":
265+
if guc_value_as_bool(val):
260266
print(
261267
f"ERROR: {guc} must be set to off before upgrading to Spock 5.0."
262268
)

0 commit comments

Comments
 (0)