On Thu, Jun 15, 2023 at 03:52:13PM +0900, Michael Paquier wrote: > It took some time to notice that, which makes me wonder how relevant > this stuff is these days.. Anyway, I would like to do like the others > and fix it, so I am proposing the attached.
Please find attached a v2 that removes the ENCODING and NO_LOCALE flags from meson.build and Makefile, that I forgot to clean up previously. Note that I am not planning to do anything here until at least v17 opens for business. -- Michael
From 24752bdac25674edb96fae18eab4c758ce0bb91a Mon Sep 17 00:00:00 2001 From: Michael Paquier <mich...@paquier.xyz> Date: Tue, 20 Jun 2023 12:45:40 +0900 Subject: [PATCH v2] Fix regression tests of unaccent to work without UTF8 support The tests of unaccent rely on UTF8 characters, and unlike any other test suite in the tree (fuzzystrmatch, citext, hstore, etc.), they would fail if run on a database that does not support UTF8 encoding. This commit fixes the tests of unaccent so as these are skipped when run on a database without UTF8 support, using the same method as the other test suits based on \if, getdatabaseencoding() and an alternate output file. This has been broken for a long time, but nobody has complained about that either, so no backpatch is done. This can be reproduced with something like REGRESS_OPTS="--no-locale --encoding=sql_ascii", for instance, even if Makefile and meson.build passed down custom options. Discussion: https://postgr.es/m/ziq1huniv2ksw...@paquier.xyz --- contrib/unaccent/Makefile | 4 ---- contrib/unaccent/expected/unaccent.out | 16 +++++++++------- contrib/unaccent/expected/unaccent_1.out | 8 ++++++++ contrib/unaccent/meson.build | 1 - contrib/unaccent/sql/unaccent.sql | 14 +++++++++++--- 5 files changed, 28 insertions(+), 15 deletions(-) create mode 100644 contrib/unaccent/expected/unaccent_1.out diff --git a/contrib/unaccent/Makefile b/contrib/unaccent/Makefile index d6c466e07a..652a3e774c 100644 --- a/contrib/unaccent/Makefile +++ b/contrib/unaccent/Makefile @@ -12,10 +12,6 @@ PGFILEDESC = "unaccent - text search dictionary that removes accents" REGRESS = unaccent -# We need a UTF8 database -ENCODING = UTF8 -NO_LOCALE = 1 - ifdef USE_PGXS PG_CONFIG = pg_config PGXS := $(shell $(PG_CONFIG) --pgxs) diff --git a/contrib/unaccent/expected/unaccent.out b/contrib/unaccent/expected/unaccent.out index ee0ac71a1c..f080707c4a 100644 --- a/contrib/unaccent/expected/unaccent.out +++ b/contrib/unaccent/expected/unaccent.out @@ -1,11 +1,13 @@ +/* + * This test must be run in a database with UTF-8 encoding, + * because other encodings don't support all the characters used. + */ +SELECT getdatabaseencoding() <> 'UTF8' + AS skip_test \gset +\if :skip_test +\quit +\endif CREATE EXTENSION unaccent; --- must have a UTF8 database -SELECT getdatabaseencoding(); - getdatabaseencoding ---------------------- - UTF8 -(1 row) - SET client_encoding TO 'UTF8'; SELECT unaccent('foobar'); unaccent diff --git a/contrib/unaccent/expected/unaccent_1.out b/contrib/unaccent/expected/unaccent_1.out new file mode 100644 index 0000000000..37aead89c0 --- /dev/null +++ b/contrib/unaccent/expected/unaccent_1.out @@ -0,0 +1,8 @@ +/* + * This test must be run in a database with UTF-8 encoding, + * because other encodings don't support all the characters used. + */ +SELECT getdatabaseencoding() <> 'UTF8' + AS skip_test \gset +\if :skip_test +\quit diff --git a/contrib/unaccent/meson.build b/contrib/unaccent/meson.build index bd629ec090..a93bf10468 100644 --- a/contrib/unaccent/meson.build +++ b/contrib/unaccent/meson.build @@ -37,6 +37,5 @@ tests += { 'sql': [ 'unaccent', ], - 'regress_args': ['--no-locale', '--encoding=UTF8'], }, } diff --git a/contrib/unaccent/sql/unaccent.sql b/contrib/unaccent/sql/unaccent.sql index 3fc0c706be..663646c1ac 100644 --- a/contrib/unaccent/sql/unaccent.sql +++ b/contrib/unaccent/sql/unaccent.sql @@ -1,7 +1,15 @@ -CREATE EXTENSION unaccent; +/* + * This test must be run in a database with UTF-8 encoding, + * because other encodings don't support all the characters used. + */ --- must have a UTF8 database -SELECT getdatabaseencoding(); +SELECT getdatabaseencoding() <> 'UTF8' + AS skip_test \gset +\if :skip_test +\quit +\endif + +CREATE EXTENSION unaccent; SET client_encoding TO 'UTF8'; -- 2.40.1
signature.asc
Description: PGP signature