@@ -1636,37 +1636,17 @@ get_collation_current_version(char collprovider, const char *collcollate)
1636
1636
}
1637
1637
else
1638
1638
#endif
1639
- if (collprovider == COLLPROVIDER_LIBC )
1639
+ if (collprovider == COLLPROVIDER_LIBC &&
1640
+ pg_strcasecmp ("C" , collcollate ) != 0 &&
1641
+ pg_strncasecmp ("C." , collcollate , 2 ) != 0 &&
1642
+ pg_strcasecmp ("POSIX" , collcollate ) != 0 )
1640
1643
{
1641
1644
#if defined(__GLIBC__ )
1642
- char * copy = pstrdup (collcollate );
1643
- char * copy_suffix = strstr (copy , "." );
1644
- bool need_version = true;
1645
-
1646
- /*
1647
- * Check for names like C.UTF-8 by chopping off the encoding suffix on
1648
- * our temporary copy, so we can skip the version.
1649
- */
1650
- if (copy_suffix )
1651
- * copy_suffix = '\0' ;
1652
- if (pg_strcasecmp ("c" , copy ) == 0 ||
1653
- pg_strcasecmp ("posix" , copy ) == 0 )
1654
- need_version = false;
1655
- pfree (copy );
1656
- if (!need_version )
1657
- return NULL ;
1658
-
1659
1645
/* Use the glibc version because we don't have anything better. */
1660
1646
collversion = pstrdup (gnu_get_libc_version ());
1661
1647
#elif defined(LC_VERSION_MASK )
1662
1648
locale_t loc ;
1663
1649
1664
- /* C[.encoding] and POSIX never change. */
1665
- if (strcmp ("C" , collcollate ) == 0 ||
1666
- strncmp ("C." , collcollate , 2 ) == 0 ||
1667
- strcmp ("POSIX" , collcollate ) == 0 )
1668
- return NULL ;
1669
-
1670
1650
/* Look up FreeBSD collation version. */
1671
1651
loc = newlocale (LC_COLLATE , collcollate , NULL );
1672
1652
if (loc )
@@ -1687,12 +1667,6 @@ get_collation_current_version(char collprovider, const char *collcollate)
1687
1667
NLSVERSIONINFOEX version = {sizeof (NLSVERSIONINFOEX )};
1688
1668
WCHAR wide_collcollate [LOCALE_NAME_MAX_LENGTH ];
1689
1669
1690
- /* These would be invalid arguments, but have no version. */
1691
- if (pg_strcasecmp ("c" , collcollate ) == 0 ||
1692
- pg_strcasecmp ("posix" , collcollate ) == 0 )
1693
- return NULL ;
1694
-
1695
- /* For all other names, ask the OS. */
1696
1670
MultiByteToWideChar (CP_ACP , 0 , collcollate , -1 , wide_collcollate ,
1697
1671
LOCALE_NAME_MAX_LENGTH );
1698
1672
if (!GetNLSVersionEx (COMPARE_STRING , wide_collcollate , & version ))
0 commit comments