1
0
mirror of https://github.com/postgres/postgres.git synced 2025-11-22 12:22:45 +03:00

Use version for builtin collations.

Given that the version field already exists, there's little reason not
to use it. Suggestion from Peter Eisentraut.

Discussion: https://postgr.es/m/613c120a-5413-4fa7-a501-6590eae558f8@eisentraut.org
Reviewed-by: Peter Eisentraut
This commit is contained in:
Jeff Davis
2024-03-29 10:52:24 -07:00
parent c2df2ed90a
commit 46a44dc372
3 changed files with 15 additions and 5 deletions

View File

@@ -1732,13 +1732,23 @@ get_collation_actual_version(char collprovider, const char *collcollate)
/*
* The only two supported locales (C and C.UTF-8) are both based on memcmp
* and are not expected to change.
* and are not expected to change, but track the version anyway.
*
* Note that the character semantics may change for some locales, but the
* collation version only tracks changes to sort order.
*/
if (collprovider == COLLPROVIDER_BUILTIN)
return NULL;
{
if (strcmp(collcollate, "C") == 0)
return "1";
else if (strcmp(collcollate, "C.UTF-8") == 0)
return "1";
else
ereport(ERROR,
(errcode(ERRCODE_WRONG_OBJECT_TYPE),
errmsg("invalid locale name \"%s\" for builtin provider",
collcollate)));
}
#ifdef USE_ICU
if (collprovider == COLLPROVIDER_ICU)