]> git.ipfire.org Git - thirdparty/postgresql.git/commitdiff
Guard against uninitialized default locale.
authorJeff Davis <jdavis@postgresql.org>
Mon, 8 Jun 2026 20:10:40 +0000 (13:10 -0700)
committerJeff Davis <jdavis@postgresql.org>
Mon, 8 Jun 2026 20:10:40 +0000 (13:10 -0700)
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

src/backend/utils/adt/pg_locale.c

index 3f1fb9fafd9724e425dd47ded4377f2cf15a572a..11d48a3916e26c0aa39b9683e801b33762c0327c 100644 (file)
@@ -1192,7 +1192,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