Skip to content

Commit 9f90b1d

Browse files
committed
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
1 parent b8e19b9 commit 9f90b1d

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

src/backend/utils/adt/pg_locale.c

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,10 @@
7070
#include <unicode/ucnv.h>
7171
#endif
7272

73+
#ifdef __GLIBC__
74+
#include <gnu/libc-version.h>
75+
#endif
76+
7377
#ifdef WIN32
7478
/*
7579
* This Windows file defines StrNCpy. We don't need it here, so we undefine
@@ -1499,7 +1503,7 @@ pg_newlocale_from_collation(Oid collid)
14991503
char *
15001504
get_collation_actual_version(char collprovider, const char *collcollate)
15011505
{
1502-
char *collversion;
1506+
char *collversion = NULL;
15031507

15041508
#ifdef USE_ICU
15051509
if (collprovider == COLLPROVIDER_ICU)
@@ -1523,7 +1527,13 @@ get_collation_actual_version(char collprovider, const char *collcollate)
15231527
}
15241528
else
15251529
#endif
1526-
collversion = NULL;
1530+
if (collprovider == COLLPROVIDER_LIBC)
1531+
{
1532+
#if defined(__GLIBC__)
1533+
/* Use the glibc version because we don't have anything better. */
1534+
collversion = pstrdup(gnu_get_libc_version());
1535+
#endif
1536+
}
15271537

15281538
return collversion;
15291539
}

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy