Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit3d9f7ec

Browse files
committed
Add test case for collation mismatch in recursive query
This isn't very important by itself, but was left on my list of thingswithout test coverage for the collation feature.
1 parent2a26639 commit3d9f7ec

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

‎src/test/regress/expected/collate.linux.utf8.out

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -630,6 +630,16 @@ HINT: You can override the collation by applying the COLLATE clause to one or b
630630
CREATE TABLE test_u AS SELECT a, b FROM collate_test1 UNION ALL SELECT a, b FROM collate_test3; -- fail
631631
ERROR: no collation was derived for column "b" with collatable type text
632632
HINT: Use the COLLATE clause to set the collation explicitly.
633+
-- collation mismatch between recursive and non-recursive term
634+
WITH RECURSIVE foo(x) AS
635+
(SELECT x FROM (VALUES('a' COLLATE "en_US"),('b')) t(x)
636+
UNION ALL
637+
SELECT (x || 'c') COLLATE "de_DE" FROM foo WHERE length(x) < 10)
638+
SELECT * FROM foo;
639+
ERROR: recursive query "foo" column 1 has collation "en_US" in non-recursive term but collation "de_DE" overall
640+
LINE 2: (SELECT x FROM (VALUES('a' COLLATE "en_US"),('b')) t(x)
641+
^
642+
HINT: Use the COLLATE clause to set the collation of the non-recursive term.
633643
-- casting
634644
SELECT CAST('42' AS text COLLATE "C");
635645
ERROR: syntax error at or near "COLLATE"

‎src/test/regress/sql/collate.linux.utf8.sql

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,13 @@ SELECT a, b FROM collate_test1 EXCEPT SELECT a, b FROM collate_test3 ORDER BY 2;
190190

191191
CREATETABLEtest_uASSELECT a, bFROM collate_test1UNION ALLSELECT a, bFROM collate_test3;-- fail
192192

193+
-- collation mismatch between recursive and non-recursive term
194+
WITH RECURSIVE foo(x)AS
195+
(SELECT xFROM (VALUES('a' COLLATE"en_US"),('b')) t(x)
196+
UNION ALL
197+
SELECT (x||'c') COLLATE"de_DE"FROM fooWHERE length(x)<10)
198+
SELECT*FROM foo;
199+
193200

194201
-- casting
195202

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp