|
|
@ -151,6 +151,13 @@ typedef struct |
|
|
|
static MemoryContext CollationCacheContext = NULL; |
|
|
|
static MemoryContext CollationCacheContext = NULL; |
|
|
|
static collation_cache_hash *CollationCache = NULL; |
|
|
|
static collation_cache_hash *CollationCache = NULL; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
|
|
|
* The collation cache is often accessed repeatedly for the same collation, so |
|
|
|
|
|
|
|
* remember the last one used. |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
static Oid last_collation_cache_oid = InvalidOid; |
|
|
|
|
|
|
|
static pg_locale_t last_collation_cache_locale = NULL; |
|
|
|
|
|
|
|
|
|
|
|
#if defined(WIN32) && defined(LC_MESSAGES) |
|
|
|
#if defined(WIN32) && defined(LC_MESSAGES) |
|
|
|
static char *IsoLocaleName(const char *); |
|
|
|
static char *IsoLocaleName(const char *); |
|
|
|
#endif |
|
|
|
#endif |
|
|
@ -1570,6 +1577,9 @@ pg_newlocale_from_collation(Oid collid) |
|
|
|
if (collid == DEFAULT_COLLATION_OID) |
|
|
|
if (collid == DEFAULT_COLLATION_OID) |
|
|
|
return &default_locale; |
|
|
|
return &default_locale; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (last_collation_cache_oid == collid) |
|
|
|
|
|
|
|
return last_collation_cache_locale; |
|
|
|
|
|
|
|
|
|
|
|
cache_entry = lookup_collation_cache(collid); |
|
|
|
cache_entry = lookup_collation_cache(collid); |
|
|
|
|
|
|
|
|
|
|
|
if (cache_entry->locale == 0) |
|
|
|
if (cache_entry->locale == 0) |
|
|
@ -1695,6 +1705,9 @@ pg_newlocale_from_collation(Oid collid) |
|
|
|
cache_entry->locale = resultp; |
|
|
|
cache_entry->locale = resultp; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
last_collation_cache_oid = collid; |
|
|
|
|
|
|
|
last_collation_cache_locale = cache_entry->locale; |
|
|
|
|
|
|
|
|
|
|
|
return cache_entry->locale; |
|
|
|
return cache_entry->locale; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|