1
0
mirror of https://github.com/postgres/postgres.git synced 2025-10-21 02:52:47 +03:00

Add pg_database_locale() to retrieve database default locale.

Reviewed-by: Peter Eisentraut <peter@eisentraut.org>
Discussion: https://postgr.es/m/0151ad01239e2cc7b3139644358cf8f7b9622ff7.camel@j-davis.com
This commit is contained in:
Jeff Davis
2025-10-18 16:25:23 -07:00
parent 67a8b49e96
commit e533524b23
2 changed files with 10 additions and 0 deletions

View File

@@ -1162,6 +1162,15 @@ init_database_collation(void)
default_locale = result; 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 * 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(). * lifetime of the backend. Thus, do not free the result with freelocale().

View File

@@ -176,6 +176,7 @@ struct pg_locale_struct
}; };
extern void init_database_collation(void); 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 pg_locale_t pg_newlocale_from_collation(Oid collid);
extern char *get_collation_actual_version(char collprovider, const char *collcollate); extern char *get_collation_actual_version(char collprovider, const char *collcollate);