citusdata / citusdata/citus

Collation regression tests fail if postgres not compiled `--with-icu`

Open
#3,278 5 comments 0 reactions 1 assignee Claimed by @serprex View on GitHub
Dominant language
C
Stars
12.8k
Forks
794
Avg merge
2d 14h
Merged PRs (30d)
31

Description

```SQL
diff -dU10 -w /Users/onderkalaci/Documents/citus_code/citus/src/test/regress/expected/pg12.out /Users/onderkalaci/Documents/citus_code/citus/src/test/regress/results/pg12.out
--- /Users/onderkalaci/Documents/citus_code/citus/src/test/regress/expected/pg12.out.modified 2019-12-10 09:59:17.000000000 +0100
+++ /Users/onderkalaci/Documents/citus_code/citus/src/test/regress/results/pg12.out.modified 2019-12-10 09:59:17.000000000 +0100
@@ -360,41 +360,37 @@
----
25
(1 row)

-- non deterministic collations
CREATE COLLATION test_pg12.case_insensitive (
provider = icu,
locale = 'und-u-ks-level2',
deterministic = false
);
+ERROR: ICU is not supported in this build
+HINT: You need to rebuild PostgreSQL using --with-icu.
CREATE TABLE col_test (
id int,
val text collate case_insensitive
);
+ERROR: collation "case_insensitive" for encoding "UTF8" does not exist
insert into col_test values
(1, 'asdF'), (2, 'vAlue'), (3, 'asDF');
+ERROR: relation "col_test" does not exist
-- Hash distribution of non deterministic collations are unsupported
select create_distributed_table('col_test', 'val');
-ERROR: Hash distributed partition columns may not use a non deterministic collation
+ERROR: relation "col_test" does not exist
select create_distributed_table('col_test', 'id');
-NOTICE: Copying data from local table...
- create_distributed_table
----------------------------------------------------------------------
-
-(1 row)
-
+ERROR: relation "col_test" does not exist
insert into col_test values
(4, 'vALue'), (5, 'AsDf'), (6, 'value');
+ERROR: relation "col_test" does not exist
select count(*)
from col_test
where val = 'asdf';
- count
--------
- 3
-(1 row)
-
+ERROR: relation "col_test" does not exist
\set VERBOSITY terse
drop schema test_pg12 cascade;
-NOTICE: drop cascades to 13 other objects
+NOTICE: drop cascades to 11 other objects
\set VERBOSITY default
SET citus.shard_replication_factor to 2;
diff -dU10 -w /Users/onderkalaci/Documents/citus_code/citus/src/test/regress/expected/distributed_collations.out /Users/onderkalaci/Documents/citus_code/citus/src/test/regress/results/distributed_collations.out
--- /Users/onderkalaci/Documents/citus_code/citus/src/test/regress/expected/distributed_collations.out.modified 2019-12-10 10:03:11.000000000 +0100
+++ /Users/onderkalaci/Documents/citus_code/citus/src/test/regress/results/distributed_collations.out.modified 2019-12-10 10:03:11.000000000 +0100
@@ -6,130 +6,122 @@
run_command_on_workers
---------------------------------------------------------------------
(localhost,57637,t,"CREATE ROLE")
(localhost,57638,t,"CREATE ROLE")
(2 rows)

CREATE SCHEMA collation_tests AUTHORIZATION collationuser;
CREATE SCHEMA collation_tests2 AUTHORIZATION collationuser;
SET search_path to collation_tests;
CREATE COLLATION german_phonebook (provider = icu, locale = 'de-u-co-phonebk');
+ERROR: ICU is not supported in this build
+HINT: You need to rebuild PostgreSQL using --with-icu.
SET citus.enable_ddl_propagation TO off;
CREATE COLLATION german_phonebook_unpropagated (provider = icu, locale = 'de-u-co-phonebk');
+ERROR: ICU is not supported in this build
+HINT: You need to rebuild PostgreSQL using --with-icu.
SET citus.enable_ddl_propagation TO on;
\c - - - :worker_1_port
SELECT c.collname, nsp.nspname, a.rolname
FROM pg_collation c
JOIN pg_namespace nsp ON nsp.oid = c.collnamespace
JOIN pg_authid a ON a.oid = c.collowner
WHERE collname like 'german_phonebook%'
ORDER BY 1,2,3;
collname | nspname | rolname
----------------------------------------------------------------------
- german_phonebook | collation_tests | postgres
-(1 row)
+----------+---------+---------
+(0 rows)

\c - - - :master_port
SET search_path to collation_tests;
CREATE TABLE test_propagate(id int, t1 text COLLATE german_phonebook,
t2 text COLLATE german_phonebook_unpropagated);
+ERROR: collation "german_phonebook" for encoding "UTF8" does not exist
INSERT INTO test_propagate VALUES (1, 'aesop', U&'\00E4sop'), (2, U&'Vo\1E9Er', 'Vossr');
+ERROR: relation "test_propagate" does not exist
SELECT create_distributed_table('test_propagate', 'id');
-NOTICE: Copying data from local table...
- create_distributed_table
----------------------------------------------------------------------
-
-(1 row)
-
+ERROR: relation "test_propagate" does not exist
-- Test COLLATE is pushed down
SELECT * FROM collation_tests.test_propagate WHERE t2 < 'b';
- id | t1 | t2
-----+-------+------
- 1 | aesop | äsop
-(1 row)
-
+ERROR: relation "collation_tests.test_propagate" does not exist
SELECT * FROM collation_tests.test_propagate WHERE t2 < 'b' COLLATE "C";
- id | t1 | t2
-----+------+-------
- 2 | Voẞr | Vossr
-(1 row)
-
+ERROR: relation "collation_tests.test_propagate" does not exist
-- Test range table with collated distribution column
CREATE TABLE test_range(key text COLLATE german_phonebook, val int);
+ERROR: collation "german_phonebook" for encoding "UTF8" does not exist
SELECT create_distributed_table('test_range', 'key', 'range');
- create_distributed_table
----------------------------------------------------------------------
-
-(1 row)
-
+ERROR: relation "test_range" does not exist
SELECT master_create_empty_shard('test_range') AS new_shard_id
\gset
+ERROR: relation "test_range" does not exist
UPDATE pg_dist_shard SET shardminvalue = 'a', shardmaxvalue = 'f'
WHERE shardid = :new_shard_id;
+ERROR: syntax error at or near ":"
SELECT master_create_empty_shard('test_range') AS new_shard_id
\gset
+ERROR: relation "test_range" does not exist
UPDATE pg_dist_shard SET shardminvalue = 'G', shardmaxvalue = 'Z'
WHERE shardid = :new_shard_id;
+ERROR: syntax error at or near ":"
-- without german_phonebook collation, this would fail
INSERT INTO test_range VALUES (U&'\00E4sop', 1), (U&'Vo\1E9Er', 2);
+ERROR: relation "test_range" does not exist
-- without german_phonebook collation, this would not be router executable
SET client_min_messages TO debug;
SELECT * FROM test_range WHERE key > 'Ab' AND key < U&'\00E4z';
-DEBUG: Creating router plan
-DEBUG: Plan is router executable
- key | val
-------+-----
- äsop | 1
-(1 row)
-
+DEBUG: relation "test_range" does not exist
+ERROR: relation "test_range" does not exist
\c - - - :worker_1_port
SELECT c.collname, nsp.nspname, a.rolname
FROM pg_collation c
JOIN pg_namespace nsp ON nsp.oid = c.collnamespace
JOIN pg_authid a ON a.oid = c.collowner
WHERE collname like 'german_phonebook%'
ORDER BY 1,2,3;
collname | nspname | rolname
----------------------------------------------------------------------
- german_phonebook | collation_tests | postgres
- german_phonebook_unpropagated | collation_tests | postgres
-(2 rows)
+----------+---------+---------
+(0 rows)

\c - - - :master_port
ALTER COLLATION collation_tests.german_phonebook RENAME TO german_phonebook2;
+ERROR: collation "collation_tests.german_phonebook" for encoding "UTF8" does not exist
ALTER COLLATION collation_tests.german_phonebook2 SET SCHEMA collation_tests2;
+ERROR: type "collation_tests.german_phonebook2" does not exist
ALTER COLLATION collation_tests2.german_phonebook2 OWNER TO collationuser;
+ERROR: collation "collation_tests2.german_phonebook2" for encoding "UTF8" does not exist
\c - - - :worker_1_port
SELECT c.collname, nsp.nspname, a.rolname
FROM pg_collation c
JOIN pg_namespace nsp ON nsp.oid = c.collnamespace
JOIN pg_authid a ON a.oid = c.collowner
WHERE collname like 'german_phonebook%'
ORDER BY 1,2,3;
collname | nspname | rolname
----------------------------------------------------------------------
- german_phonebook2 | collation_tests2 | collationuser
- german_phonebook_unpropagated | collation_tests | postgres
-(2 rows)
+----------+---------+---------
+(0 rows)

\c - - - :master_port
SET client_min_messages TO error; -- suppress cascading objects dropping
DROP SCHEMA collation_tests CASCADE;
DROP SCHEMA collation_tests2 CASCADE;
-- This is hacky, but we should clean-up the resources as below
\c - - - :worker_1_port
SET client_min_messages TO error; -- suppress cascading objects dropping
DROP SCHEMA collation_tests CASCADE;
+ERROR: schema "collation_tests" does not exist
DROP SCHEMA collation_tests2 CASCADE;
+ERROR: schema "collation_tests2" does not exist
\c - - - :worker_2_port
SET client_min_messages TO error; -- suppress cascading objects dropping
DROP SCHEMA collation_tests CASCADE;
+ERROR: schema "collation_tests" does not exist
DROP SCHEMA collation_tests2 CASCADE;
+ERROR: schema "collation_tests2" does not exist
\c - - - :master_port
DROP USER collationuser;
SELECT run_command_on_workers($$DROP USER collationuser;$$);
run_command_on_workers
---------------------------------------------------------------------
(localhost,57637,t,"DROP ROLE")
(localhost,57638,t,"DROP ROLE")
(2 rows)

diff -dU10 -w /Users/onderkalaci/Documents/citus_code/citus/src/test/regress/expected/distributed_collations_conflict.out /Users/onderkalaci/Documents/citus_code/citus/src/test/regress/results/distributed_collations_conflict.out
--- /Users/onderkalaci/Documents/citus_code/citus/src/test/regress/expected/distributed_collations_conflict.out.modified 2019-12-10 10:03:11.000000000 +0100
+++ /Users/onderkalaci/Documents/citus_code/citus/src/test/regress/results/distributed_collations_conflict.out.modified 2019-12-10 10:03:11.000000000 +0100
@@ -5,92 +5,87 @@
(localhost,57637,t,"CREATE SCHEMA")
(localhost,57638,t,"CREATE SCHEMA")
(2 rows)

\c - - - :worker_1_port
SET search_path TO collation_conflict;
CREATE COLLATION caseinsensitive (
provider = icu,
locale = 'und-u-ks-level2'
);
+ERROR: ICU is not supported in this build
+HINT: You need to rebuild PostgreSQL using --with-icu.
\c - - - :master_port
SET search_path TO collation_conflict;
CREATE COLLATION caseinsensitive (
provider = icu,
locale = 'und-u-ks-level2'
);
+ERROR: ICU is not supported in this build
+HINT: You need to rebuild PostgreSQL using --with-icu.
CREATE TABLE tblcoll(val text COLLATE caseinsensitive);
+ERROR: collation "caseinsensitive" for encoding "UTF8" does not exist
SELECT create_reference_table('tblcoll');
- create_reference_table
----------------------------------------------------------------------
-
-(1 row)
-
+ERROR: relation "tblcoll" does not exist
\c - - - :worker_1_port
SELECT c.collname, nsp.nspname, a.rolname
FROM pg_collation c
JOIN pg_namespace nsp ON nsp.oid = c.collnamespace
JOIN pg_authid a ON a.oid = c.collowner
WHERE collname like 'caseinsensitive%'
ORDER BY 1,2,3;
collname | nspname | rolname
----------------------------------------------------------------------
- caseinsensitive | collation_conflict | postgres
-(1 row)
+----------+---------+---------
+(0 rows)

\c - - - :master_port
SET search_path TO collation_conflict;
-- Now drop & recreate in order to make sure rename detects the existing renamed objects
-- hide cascades
--SET client_min_messages TO error;
DROP TABLE tblcoll;
+ERROR: table "tblcoll" does not exist
DROP COLLATION caseinsensitive;
+ERROR: collation "caseinsensitive" for encoding "UTF8" does not exist
\c - - - :worker_1_port
SET search_path TO collation_conflict;
CREATE COLLATION caseinsensitive (
provider = icu,
locale = 'und-u-ks-level1'
);
+ERROR: ICU is not supported in this build
+HINT: You need to rebuild PostgreSQL using --with-icu.
\c - - - :master_port
SET search_path TO collation_conflict;
CREATE COLLATION caseinsensitive (
provider = icu,
locale = 'und-u-ks-level2'
);
+ERROR: ICU is not supported in this build
+HINT: You need to rebuild PostgreSQL using --with-icu.
CREATE TABLE tblcoll(val text COLLATE caseinsensitive);
+ERROR: collation "caseinsensitive" for encoding "UTF8" does not exist
SELECT create_reference_table('tblcoll');
- create_reference_table
----------------------------------------------------------------------
-
-(1 row)
-
+ERROR: relation "tblcoll" does not exist
\c - - - :worker_1_port
SELECT c.collname, nsp.nspname, a.rolname
FROM pg_collation c
JOIN pg_namespace nsp ON nsp.oid = c.collnamespace
JOIN pg_authid a ON a.oid = c.collowner
WHERE collname like 'caseinsensitive%'
ORDER BY 1,2,3;
collname | nspname | rolname
----------------------------------------------------------------------
- caseinsensitive | collation_conflict | postgres
- caseinsensitive(citus_backup_0) | collation_conflict | postgres
-(2 rows)
+----------+---------+---------
+(0 rows)

\c - - - :master_port
SET search_path TO collation_conflict;
-- now test worker_create_or_replace_object directly
SELECT worker_create_or_replace_object($$CREATE COLLATION collation_conflict.caseinsensitive (provider = 'icu', lc_collate = 'und-u-ks-level2', lc_ctype = 'und-u-ks-level2')$$);
- worker_create_or_replace_object
----------------------------------------------------------------------
- f
-(1 row)
-
+ERROR: ICU is not supported in this build
+HINT: You need to rebuild PostgreSQL using --with-icu.
SELECT worker_create_or_replace_object($$CREATE COLLATION collation_conflict.caseinsensitive (provider = 'icu', lc_collate = 'und-u-ks-level2', lc_ctype = 'und-u-ks-level2')$$);
- worker_create_or_replace_object
----------------------------------------------------------------------
- f
-(1 row)
-
+ERROR: ICU is not supported in this build
+HINT: You need to rebuild PostgreSQL using --with-icu.
-- hide cascades
SET client_min_messages TO error;
DROP SCHEMA collation_conflict CASCADE;

```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.