Report PostgreSQL collation drift in live smoke
GeoIntel CI / docs-smoke (push) Has been cancelled
GeoIntel CI / contract-smoke (push) Has been cancelled

This commit is contained in:
Codex
2026-06-17 06:47:09 +02:00
parent 4f23b0cd9d
commit 35b42878c7
6 changed files with 122 additions and 0 deletions
+60
View File
@@ -69,6 +69,26 @@ required_objects = [
with get_engine().connect() as connection:
postgis_version = connection.execute(text("SELECT PostGIS_Version()")).scalar()
print(f"PostGIS version: {postgis_version}")
collation_row = connection.execute(
text(
"SELECT datname, datcollversion, pg_database_collation_actual_version(oid) AS actual_version "
"FROM pg_database WHERE datname = current_database()"
)
).mappings().one()
stored_version = collation_row["datcollversion"]
actual_version = collation_row["actual_version"]
if stored_version != actual_version:
database_name = str(collation_row["datname"]).replace('"', '""')
print(
"COLLATION_VERSION_MISMATCH: "
f"database={collation_row['datname']} stored={stored_version} actual={actual_version}"
)
print(
"After reviewing backups and indexes, acknowledge with: "
f'ALTER DATABASE "{database_name}" REFRESH COLLATION VERSION;'
)
else:
print("Database collation version: ok")
missing = [
object_name
@@ -154,6 +174,26 @@ required_objects = [
with get_engine().connect() as connection:
postgis_version = connection.execute(text("SELECT PostGIS_Version()")).scalar()
print(f"PostGIS version: {postgis_version}")
collation_row = connection.execute(
text(
"SELECT datname, datcollversion, pg_database_collation_actual_version(oid) AS actual_version "
"FROM pg_database WHERE datname = current_database()"
)
).mappings().one()
stored_version = collation_row["datcollversion"]
actual_version = collation_row["actual_version"]
if stored_version != actual_version:
database_name = str(collation_row["datname"]).replace('"', '""')
print(
"COLLATION_VERSION_MISMATCH: "
f"database={collation_row['datname']} stored={stored_version} actual={actual_version}"
)
print(
"After reviewing backups and indexes, acknowledge with: "
f'ALTER DATABASE "{database_name}" REFRESH COLLATION VERSION;'
)
else:
print("Database collation version: ok")
missing = [
object_name
@@ -267,6 +307,26 @@ required_objects = [
with get_engine().connect() as connection:
postgis_version = connection.execute(text("SELECT PostGIS_Version()")).scalar()
print(f"PostGIS version: {postgis_version}")
collation_row = connection.execute(
text(
"SELECT datname, datcollversion, pg_database_collation_actual_version(oid) AS actual_version "
"FROM pg_database WHERE datname = current_database()"
)
).mappings().one()
stored_version = collation_row["datcollversion"]
actual_version = collation_row["actual_version"]
if stored_version != actual_version:
database_name = str(collation_row["datname"]).replace('"', '""')
print(
"COLLATION_VERSION_MISMATCH: "
f"database={collation_row['datname']} stored={stored_version} actual={actual_version}"
)
print(
"After reviewing backups and indexes, acknowledge with: "
f'ALTER DATABASE "{database_name}" REFRESH COLLATION VERSION;'
)
else:
print("Database collation version: ok")
missing = [
object_name