From 432fe83b4305eaf716b331c66ab6c221eb6708a4 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E8=A3=B4=E7=8E=89=E6=9E=97?= <peiyulin@bytedance.com>
Date: Tue, 13 Apr 2021 17:23:57 +0800
Subject: [PATCH] add regress

---
 src/test/regress/expected/create_cast.out | 9 +++++++++
 src/test/regress/sql/create_cast.sql      | 6 ++++++
 2 files changed, 15 insertions(+)

diff --git a/src/test/regress/expected/create_cast.out b/src/test/regress/expected/create_cast.out
index 88f94a6..2ca0fb8 100644
--- a/src/test/regress/expected/create_cast.out
+++ b/src/test/regress/expected/create_cast.out
@@ -72,3 +72,12 @@ SELECT 1234::int4::casttesttype; -- Should work now
  foo1234
 (1 row)
 
+-- Test coerce a non-collatable type with collation
+CREATE VIEW cast_with_collation(c1) AS (SELECT ('1' COLLATE "C")::INT FROM generate_series(1, 10));
+select count(*) from cast_with_collation;
+ count 
+-------
+    10
+(1 row)
+
+DROP VIEW cast_with_collation;
diff --git a/src/test/regress/sql/create_cast.sql b/src/test/regress/sql/create_cast.sql
index b11cf88..3888857 100644
--- a/src/test/regress/sql/create_cast.sql
+++ b/src/test/regress/sql/create_cast.sql
@@ -52,3 +52,9 @@ $$ SELECT ('foo'::text || $1::text)::casttesttype; $$;
 
 CREATE CAST (int4 AS casttesttype) WITH FUNCTION int4_casttesttype(int4) AS IMPLICIT;
 SELECT 1234::int4::casttesttype; -- Should work now
+
+
+-- Test coerce a non-collatable type with collation
+CREATE VIEW cast_with_collation(c1) AS (SELECT ('1' COLLATE "C")::INT FROM generate_series(1, 10));
+select count(*) from cast_with_collation;
+DROP VIEW cast_with_collation;
\ No newline at end of file
-- 
2.23.0

