1
0
mirror of https://github.com/postgres/postgres.git synced 2026-10-23 13:29:09 +03:00

Guard against uninitialized default locale.

No known problem today, but defend against issues like dbf217c1c7 in
the future.

Discussion: https://postgr.es/m/d080287d8d2d14c246c86be2e9eb611fb6b27b11.camel@j-davis.com
Reviewed-by: Ayush Tiwari <ayushtiwari.slg01@gmail.com>
Backpatch-through: 17
This commit is contained in:
Jeff Davis
2026-06-08 13:10:40 -07:00
parent c090bef07d
commit 26bd362655

View File

@@ -1199,7 +1199,13 @@ pg_newlocale_from_collation(Oid collid)
bool found;
if (collid == DEFAULT_COLLATION_OID)
{
/* should not happen: init_database_collation() not yet run */
if (default_locale == NULL)
elog(ERROR, "default locale not initialized");
return default_locale;
}
/*
* Some callers expect C_COLLATION_OID to succeed even without catalog