diff --git a/src/backend/utils/adt/pg_locale.c b/src/backend/utils/adt/pg_locale.c index 3860ada1905..00d1e031472 100644 --- a/src/backend/utils/adt/pg_locale.c +++ b/src/backend/utils/adt/pg_locale.c @@ -1162,6 +1162,15 @@ init_database_collation(void) default_locale = result; } +/* + * Get database default locale. + */ +pg_locale_t +pg_database_locale(void) +{ + return pg_newlocale_from_collation(DEFAULT_COLLATION_OID); +} + /* * Create a pg_locale_t from a collation OID. Results are cached for the * lifetime of the backend. Thus, do not free the result with freelocale(). diff --git a/src/include/utils/pg_locale.h b/src/include/utils/pg_locale.h index 29c21d4413c..86c48c34f26 100644 --- a/src/include/utils/pg_locale.h +++ b/src/include/utils/pg_locale.h @@ -176,6 +176,7 @@ struct pg_locale_struct }; extern void init_database_collation(void); +extern pg_locale_t pg_database_locale(void); extern pg_locale_t pg_newlocale_from_collation(Oid collid); extern char *get_collation_actual_version(char collprovider, const char *collcollate);