Commit 9f90b1d0 authored by Peter Eisentraut's avatar Peter Eisentraut

Use libc version as a collation version on glibc systems.

Using glibc's version number to detect potential collation definition
changes is not 100% reliable, but it's better than nothing.

Author: Thomas Munro
Reviewed-by: Peter Eisentraut
Discussion: https://postgr.es/m/4b76c6d4-ae5e-0dc6-7d0d-b5c796a07e34%402ndquadrant.com
parent b8e19b93
...@@ -70,6 +70,10 @@ ...@@ -70,6 +70,10 @@
#include <unicode/ucnv.h> #include <unicode/ucnv.h>
#endif #endif
#ifdef __GLIBC__
#include <gnu/libc-version.h>
#endif
#ifdef WIN32 #ifdef WIN32
/* /*
* This Windows file defines StrNCpy. We don't need it here, so we undefine * This Windows file defines StrNCpy. We don't need it here, so we undefine
...@@ -1499,7 +1503,7 @@ pg_newlocale_from_collation(Oid collid) ...@@ -1499,7 +1503,7 @@ pg_newlocale_from_collation(Oid collid)
char * char *
get_collation_actual_version(char collprovider, const char *collcollate) get_collation_actual_version(char collprovider, const char *collcollate)
{ {
char *collversion; char *collversion = NULL;
#ifdef USE_ICU #ifdef USE_ICU
if (collprovider == COLLPROVIDER_ICU) if (collprovider == COLLPROVIDER_ICU)
...@@ -1523,7 +1527,13 @@ get_collation_actual_version(char collprovider, const char *collcollate) ...@@ -1523,7 +1527,13 @@ get_collation_actual_version(char collprovider, const char *collcollate)
} }
else else
#endif #endif
collversion = NULL; if (collprovider == COLLPROVIDER_LIBC)
{
#if defined(__GLIBC__)
/* Use the glibc version because we don't have anything better. */
collversion = pstrdup(gnu_get_libc_version());
#endif
}
return collversion; return collversion;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment