diff options
author | Peter Eisentraut <peter_e@gmx.net> | 2017-08-09 20:34:51 -0400 |
---|---|---|
committer | Peter Eisentraut <peter_e@gmx.net> | 2017-08-10 22:14:00 -0400 |
commit | d6391b03b3025372620925e5746e65c288a1e371 (patch) | |
tree | ee2b9a7402b148127194b70c6b6c4766e7c17bd7 /src | |
parent | b83e54564ad0733f5382b20c04695ee9fb4cf451 (diff) | |
download | postgresql-d6391b03b3025372620925e5746e65c288a1e371.tar.gz postgresql-d6391b03b3025372620925e5746e65c288a1e371.zip |
Reject use of ucol_strcollUTF8() before ICU 53
Various bugs can cause crashes, so don't use that function before ICU
53. It will fall back to the code path used for other encodings.
Since we now tie the function availability to an ICU version, we don't
need the configure test anymore. That also resolves the issue that the
test result was previously hardcoded for Windows.
researched by Daniel Verite <daniel@manitou-mail.org>, Peter Geoghegan
<pg@bowt.ie>, Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://www.postgresql.org/message-id/flat/f1438ec6-22aa-4029-9a3b-26f79d330e72%40manitou-mail.org
Diffstat (limited to 'src')
-rw-r--r-- | src/include/pg_config.h.in | 3 | ||||
-rw-r--r-- | src/include/pg_config.h.win32 | 3 | ||||
-rw-r--r-- | src/include/utils/pg_locale.h | 13 |
3 files changed, 13 insertions, 6 deletions
diff --git a/src/include/pg_config.h.in b/src/include/pg_config.h.in index 7a05c7e5b85..dcb7a1a3209 100644 --- a/src/include/pg_config.h.in +++ b/src/include/pg_config.h.in @@ -606,9 +606,6 @@ /* Define to 1 if you have the external array `tzname'. */ #undef HAVE_TZNAME -/* Define to 1 if you have the `ucol_strcollUTF8' function. */ -#undef HAVE_UCOL_STRCOLLUTF8 - /* Define to 1 if you have the <ucred.h> header file. */ #undef HAVE_UCRED_H diff --git a/src/include/pg_config.h.win32 b/src/include/pg_config.h.win32 index 9d3021ced88..7f60670fa6f 100644 --- a/src/include/pg_config.h.win32 +++ b/src/include/pg_config.h.win32 @@ -457,9 +457,6 @@ /* Define to 1 if you have the external array `tzname'. */ /* #undef HAVE_TZNAME */ -/* Define to 1 if you have the `ucol_strcollUTF8' function. */ -#define HAVE_UCOL_STRCOLLUTF8 1 - /* Define to 1 if the system has the type `uint64'. */ /* #undef HAVE_UINT64 */ diff --git a/src/include/utils/pg_locale.h b/src/include/utils/pg_locale.h index a02d27ba266..f3e04d4d8ce 100644 --- a/src/include/utils/pg_locale.h +++ b/src/include/utils/pg_locale.h @@ -21,6 +21,19 @@ #include "utils/guc.h" +#ifdef USE_ICU +/* + * ucol_strcollUTF8() was introduced in ICU 50, but it is buggy before ICU 53. + * (see + * <https://www.postgresql.org/message-id/flat/f1438ec6-22aa-4029-9a3b-26f79d330e72%40manitou-mail.org>) + */ +#if U_ICU_VERSION_MAJOR_NUM >= 53 +#define HAVE_UCOL_STRCOLLUTF8 1 +#else +#undef HAVE_UCOL_STRCOLLUTF8 +#endif +#endif + /* GUC settings */ extern char *locale_messages; |