mirror of https://github.com/postgres/postgres
The tests collate.icu.utf8 and collate.linux.utf8 were previously only run when explicitly selected via EXTRA_TESTS. They require a UTF8 database, because the error messages in the expected files refer to that, and they use some non-ASCII characters in the tests. Since users can select any locale and encoding for the regression test run, it was not possible to include these tests automatically. To fix, use psql's \if facility to check various prerequisites such as platform and the server encoding and quit the tests at the very beginning if the configuration is not adequate. We then need to maintain alternative expected files for these tests, but they are very tiny and never need to change after this. These two tests are now run automatically as part of the regression tests. Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us> Discussion: https://www.postgresql.org/message-id/flat/052295c2-a2e1-9a21-bd36-8fbff8686cf3%402ndquadrant.compull/47/head
parent
870b1d6800
commit
f140007050
@ -0,0 +1,9 @@ |
||||
/* |
||||
* This test is for ICU collations. |
||||
*/ |
||||
/* skip test if not UTF8 server encoding or no ICU collations installed */ |
||||
SELECT getdatabaseencoding() <> 'UTF8' OR |
||||
(SELECT count(*) FROM pg_collation WHERE collprovider = 'i') = 0 |
||||
AS skip_test \gset |
||||
\if :skip_test |
||||
\quit |
@ -0,0 +1,11 @@ |
||||
/* |
||||
* This test is for Linux/glibc systems and assumes that a full set of |
||||
* locales is installed. It must be run in a database with UTF-8 encoding, |
||||
* because other encodings don't support all the characters used. |
||||
*/ |
||||
SELECT getdatabaseencoding() <> 'UTF8' OR |
||||
(SELECT count(*) FROM pg_collation WHERE collname IN ('de_DE', 'en_US', 'sv_SE', 'tr_TR') AND collencoding = pg_char_to_encoding('UTF8')) <> 4 OR |
||||
version() !~ 'linux-gnu' |
||||
AS skip_test \gset |
||||
\if :skip_test |
||||
\quit |
Loading…
Reference in new issue