Thread: Regression test collate.icu.utf8 failed on REL_14_STABLE

Regression test collate.icu.utf8 failed on REL_14_STABLE

From
Japin Li
Date:
Hi, hackers

I find when I compile PG 14 with --with-icu, collate.icu.utf8 and foreign_data
regression tests will failed.  However it is OK on REL_15_STABLE and master.
I also test this on REL_13_STABLE, and it also failed.  Here is the regression
diffs.

diff -U3 /home/japin/Codes/postgres/build/../src/test/regress/expected/collate.icu.utf8.out
/home/japin/Codes/postgres/build/src/test/regress/results/collate.icu.utf8.out
--- /home/japin/Codes/postgres/build/../src/test/regress/expected/collate.icu.utf8.out    2023-08-14 17:37:31.960448245
+0800
+++ /home/japin/Codes/postgres/build/src/test/regress/results/collate.icu.utf8.out    2023-08-14 21:30:44.335214886
+0800
@@ -1035,6 +1035,9 @@
           quote_literal(current_setting('lc_ctype')) || ');';
 END
 $$;
+ERROR:  collations with different collate and ctype values are not supported by ICU
+CONTEXT:  SQL statement "CREATE COLLATION test1 (provider = icu, lc_collate = 'C.UTF-8', lc_ctype = 'en_US.UTF-8');"
+PL/pgSQL function inline_code_block line 3 at EXECUTE
 CREATE COLLATION test3 (provider = icu, lc_collate = 'en_US.utf8'); -- fail, need lc_ctype
 ERROR:  parameter "lc_ctype" must be specified
 CREATE COLLATION testx (provider = icu, locale = 'nonsense'); /* never fails with ICU */  DROP COLLATION testx;
@@ -1045,13 +1048,12 @@
  collname 
 ----------
  test0
- test1
  test5
-(3 rows)
+(2 rows)
 
 ALTER COLLATION test1 RENAME TO test11;
+ERROR:  collation "test1" for encoding "UTF8" does not exist
 ALTER COLLATION test0 RENAME TO test11; -- fail
-ERROR:  collation "test11" already exists in schema "collate_tests"
 ALTER COLLATION test1 RENAME TO test22; -- fail
 ERROR:  collation "test1" for encoding "UTF8" does not exist
 ALTER COLLATION test11 OWNER TO regress_test_role;
@@ -1059,18 +1061,19 @@
 ERROR:  role "nonsense" does not exist
 ALTER COLLATION test11 SET SCHEMA test_schema;
 COMMENT ON COLLATION test0 IS 'US English';
+ERROR:  collation "test0" for encoding "UTF8" does not exist
 SELECT collname, nspname, obj_description(pg_collation.oid, 'pg_collation')
     FROM pg_collation JOIN pg_namespace ON (collnamespace = pg_namespace.oid)
     WHERE collname LIKE 'test%'
     ORDER BY 1;
  collname |    nspname    | obj_description 
 ----------+---------------+-----------------
- test0    | collate_tests | US English
  test11   | test_schema   | 
  test5    | collate_tests | 
-(3 rows)
+(2 rows)
 
 DROP COLLATION test0, test_schema.test11, test5;
+ERROR:  collation "test0" for encoding "UTF8" does not exist
 DROP COLLATION test0; -- fail
 ERROR:  collation "test0" for encoding "UTF8" does not exist
 DROP COLLATION IF EXISTS test0;
@@ -1078,10 +1081,17 @@
 SELECT collname FROM pg_collation WHERE collname LIKE 'test%';
  collname 
 ----------
-(0 rows)
+ test11
+ test5
+(2 rows)
 
 DROP SCHEMA test_schema;
+ERROR:  cannot drop schema test_schema because other objects depend on it
+DETAIL:  collation test_schema.test11 depends on schema test_schema
+HINT:  Use DROP ... CASCADE to drop the dependent objects too.
 DROP ROLE regress_test_role;
+ERROR:  role "regress_test_role" cannot be dropped because some objects depend on it
+DETAIL:  owner of collation test_schema.test11
 -- ALTER
 ALTER COLLATION "en-x-icu" REFRESH VERSION;
 NOTICE:  version has not changed
diff -U3 /home/japin/Codes/postgres/build/../src/test/regress/expected/foreign_data.out
/home/japin/Codes/postgres/build/src/test/regress/results/foreign_data.out
--- /home/japin/Codes/postgres/build/../src/test/regress/expected/foreign_data.out    2023-08-14 17:37:31.964448260
+0800
+++ /home/japin/Codes/postgres/build/src/test/regress/results/foreign_data.out    2023-08-14 21:30:55.571170376 +0800
@@ -5,10 +5,13 @@
 -- Suppress NOTICE messages when roles don't exist
 SET client_min_messages TO 'warning';
 DROP ROLE IF EXISTS regress_foreign_data_user, regress_test_role, regress_test_role2, regress_test_role_super,
regress_test_indirect,regress_unprivileged_role;
 
+ERROR:  role "regress_test_role" cannot be dropped because some objects depend on it
+DETAIL:  owner of collation test_schema.test11
 RESET client_min_messages;
 CREATE ROLE regress_foreign_data_user LOGIN SUPERUSER;
 SET SESSION AUTHORIZATION 'regress_foreign_data_user';
 CREATE ROLE regress_test_role;
+ERROR:  role "regress_test_role" already exists
 CREATE ROLE regress_test_role2;
 CREATE ROLE regress_test_role_super SUPERUSER;
 CREATE ROLE regress_test_indirect;

Is it a bug that fixed in REL_15_STABLE? If yes, why not backpatch?


-- 
Regrads,
Japin Li



Re: Regression test collate.icu.utf8 failed on REL_14_STABLE

From
Andy Fan
Date:


 DROP SCHEMA test_schema;
+ERROR:  cannot drop schema test_schema because other objects depend on it
+DETAIL:  collation test_schema.test11 depends on schema test_schema
+HINT:  Use DROP ... CASCADE to drop the dependent objects too.
 DROP ROLE regress_test_role;
+ERROR:  role "regress_test_role" cannot be dropped because some objects depend on it
+DETAIL:  owner of collation test_schema.test11
+ERROR:  role "regress_test_role" cannot be dropped because some objects depend on it
+DETAIL:  owner of collation test_schema.test11

+ERROR:  role "regress_test_role" already exists




Did you run 'make installcheck' rather than 'make check' and there
was a failure before this round of test? This looks to me that there
are some objects are not cleaned well before this run.  you can try
'make installcheck' with a pretty clean setup or run 'make check'
directly to verify this.

--
Best Regards
Andy Fan

Re: Regression test collate.icu.utf8 failed on REL_14_STABLE

From
Japin Li
Date:
On Tue, 15 Aug 2023 at 08:49, Andy Fan <zhihui.fan1213@gmail.com> wrote:
>>
>>
>>
>>  DROP SCHEMA test_schema;
>> +ERROR:  cannot drop schema test_schema because other objects depend on it
>> +DETAIL:  collation test_schema.test11 depends on schema test_schema
>> +HINT:  Use DROP ... CASCADE to drop the dependent objects too.
>>  DROP ROLE regress_test_role;
>> +ERROR:  role "regress_test_role" cannot be dropped because some objects
>> depend on it
>> +DETAIL:  owner of collation test_schema.test11
>> +ERROR:  role "regress_test_role" cannot be dropped because some objects
>> depend on it
>> +DETAIL:  owner of collation test_schema.test11
>>
>> +ERROR:  role "regress_test_role" already exists
>>
>>
>>
>>
> Did you run 'make installcheck' rather than 'make check' and there
> was a failure before this round of test? This looks to me that there
> are some objects are not cleaned well before this run.  you can try
> 'make installcheck' with a pretty clean setup or run 'make check'
> directly to verify this.

I used `make check` and cleanup the entire build directory.  Here is my
compile & build script.

$ cat compile.sh
#!/bin/bash

set -e
rm -rf $(ls -I '*.sh')

../configure \
        --prefix=$PWD/pg \
        --enable-tap-tests \
        --enable-debug \
        --enable-cassert \
        --enable-depend \
        --enable-dtrace \
        --with-icu \
        --with-llvm \
        --with-openssl \
        --with-python \
        --with-libxml \
        --with-libxslt \
        --with-lz4 \
        --with-pam \
        CFLAGS='-O0 -Wmissing-prototypes -Wincompatible-pointer-types' \
        >configure.log 2>&1
make -j $(nproc) -s && make install -s
(cd contrib/ && make -j $(nproc) -s && make install -s)

-- 
Regrads,
Japin Li



Re: Regression test collate.icu.utf8 failed on REL_14_STABLE

From
Japin Li
Date:
On Tue, 15 Aug 2023 at 08:54, Japin Li <japinli@hotmail.com> wrote:
> On Tue, 15 Aug 2023 at 08:49, Andy Fan <zhihui.fan1213@gmail.com> wrote:
>>>
>>>
>>>
>>>  DROP SCHEMA test_schema;
>>> +ERROR:  cannot drop schema test_schema because other objects depend on it
>>> +DETAIL:  collation test_schema.test11 depends on schema test_schema
>>> +HINT:  Use DROP ... CASCADE to drop the dependent objects too.
>>>  DROP ROLE regress_test_role;
>>> +ERROR:  role "regress_test_role" cannot be dropped because some objects
>>> depend on it
>>> +DETAIL:  owner of collation test_schema.test11
>>> +ERROR:  role "regress_test_role" cannot be dropped because some objects
>>> depend on it
>>> +DETAIL:  owner of collation test_schema.test11
>>>
>>> +ERROR:  role "regress_test_role" already exists
>>>
>>>
>>>
>>>
>> Did you run 'make installcheck' rather than 'make check' and there
>> was a failure before this round of test? This looks to me that there
>> are some objects are not cleaned well before this run.  you can try
>> 'make installcheck' with a pretty clean setup or run 'make check'
>> directly to verify this.
>

Thanks Andy, I think I find the root cause. In my environment, LANG has
different setting from others.

$ locale
LANG=C.UTF-8
LANGUAGE=
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_PAPER="en_US.UTF-8"
LC_NAME="en_US.UTF-8"
LC_ADDRESS="en_US.UTF-8"
LC_TELEPHONE="en_US.UTF-8"
LC_MEASUREMENT="en_US.UTF-8"
LC_IDENTIFICATION="en_US.UTF-8"
LC_ALL=en_US.UTF-8

Then, I set LANG to en_US.UTF-8, all tests passed.  What I'm curious about
is why PG 15 can pass.

-- 
Regrads,
Japin Li