Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit382a821

Browse files
committed
Allow NULL version for individual collations.
Remove the documented restriction that collation providers must eitherreturn NULL for all collations or non-NULL for all collations.Use NULL for glibc collations like "C.UTF-8", which might otherwise leadfuture proposed commits to force unnecessary index rebuilds.Reviewed-by: Peter Eisentraut <peter.eisentraut@2ndquadrant.com>Discussion:https://postgr.es/m/CA%2BhUKGJvqup3s%2BJowVTcacZADO6dOhfdBmvOPHLS3KXUJu41Jw%40mail.gmail.com
1 parentdd8e191 commit382a821

File tree

1 file changed

+17
-4
lines changed

1 file changed

+17
-4
lines changed

‎src/backend/utils/adt/pg_locale.c

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1505,10 +1505,6 @@ pg_newlocale_from_collation(Oid collid)
15051505
/*
15061506
* Get provider-specific collation version string for the given collation from
15071507
* the operating system/library.
1508-
*
1509-
* A particular provider must always either return a non-NULL string or return
1510-
* NULL (if it doesn't support versions). It must not return NULL for some
1511-
* collcollate and not NULL for others.
15121508
*/
15131509
char*
15141510
get_collation_actual_version(charcollprovider,constchar*collcollate)
@@ -1540,6 +1536,23 @@ get_collation_actual_version(char collprovider, const char *collcollate)
15401536
if (collprovider==COLLPROVIDER_LIBC)
15411537
{
15421538
#if defined(__GLIBC__)
1539+
char*copy=pstrdup(collcollate);
1540+
char*copy_suffix=strstr(copy,".");
1541+
boolneed_version= true;
1542+
1543+
/*
1544+
* Check for names like C.UTF-8 by chopping off the encoding suffix on
1545+
* our temporary copy, so we can skip the version.
1546+
*/
1547+
if (copy_suffix)
1548+
*copy_suffix='\0';
1549+
if (pg_strcasecmp("c",copy)==0||
1550+
pg_strcasecmp("posix",copy)==0)
1551+
need_version= false;
1552+
pfree(copy);
1553+
if (!need_version)
1554+
returnNULL;
1555+
15431556
/* Use the glibc version because we don't have anything better. */
15441557
collversion=pstrdup(gnu_get_libc_version());
15451558
#endif

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp