Test_extensions installcheck fails with ICU provider, workaround

From: Aleksei Fakeev <a(dot)fakeev(at)postgrespro(dot)ru>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Test_extensions installcheck fails with ICU provider, workaround
Date: 2024-07-02 10:38:33
Message-ID: a2fd691f8d9f1325cec1283b161d6a8e@postgrespro.ru
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hello there,

The test src/test/modules/test_extensions/sql/test_extensions.sql don't
pass during make installcheck on the builds with ICU support (configure
--with-icu) and with database created with this one's locale provider
(initdb --locale-provider=icu --icu-locale=en-US).

A root cause is unstable sorting order of the output of the psql command
\dx+, which is sorted according to the current locale rules, and then
compared to expected etalon in the test, which was sorted with different
provider rules.

Since the characters ')' and ',' have different orders when sorted by
the ICU provider and ASCII sorted (--no-locale), the following output
lines change their positions relative to each other:

"function varbitrange(bit varying,bit varying)"

"function varbitrange(bit varying,bit varying,text)"

I tried to use the \dx+ replacement function in this test with locale
provider-independent sorting, and it solves the problem:

CREATE OR REPLACE FUNCTION dx_plus(schema_name char varying) RETURNS
TABLE("Object description" char varying) AS

$$

BEGIN

RETURN QUERY SELECT obj_descr::varchar AS "Object
description" FROM (SELECT regexp_replace(pg_describe_object(classid,
objid, objsubid)

, 'pg_temp_\d+'

, 'pg_temp', 'g') AS obj_descr

FROM pg_depend

WHERE refclassid = 'pg_extension'::regclass

AND deptype = 'e'

AND refobjid = (SELECT oid FROM pg_extension WHERE
extname = schema_name))

ORDER BY length(obj_descr), obj_descr;

END;

$$

__

PS:

Patches for a master branch are attached.

Attachment Content-Type Size
test_extensions-sql.diff application/octet-stream 2.9 KB
test_extensions-out.diff application/octet-stream 11.2 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Aleksander Alekseev 2024-07-02 10:46:21 Re: CREATE OR REPLACE MATERIALIZED VIEW
Previous Message Joel Jacobson 2024-07-02 10:38:07 Re: Add pg_get_acl() function get the ACL for a database object