22
33import java .sql .ResultSet ;
44import java .sql .SQLException ;
5+ import java .sql .Statement ;
6+ import java .util .Locale ;
57import java .util .Properties ;
68
79import org .testng .Assert ;
@@ -18,4 +20,26 @@ public void testGetTypeInfo() throws SQLException {
1820 }
1921 }
2022 }
23+
24+ @ Test (groups = "integration" )
25+ public void testTableComment () throws SQLException {
26+ String tableName = "test_table_comment" ;
27+ String tableComment = "table comments" ;
28+ try (ClickHouseConnection conn = newConnection (new Properties ());
29+ Statement s = conn .createStatement ()) {
30+ // https://github.com/ClickHouse/ClickHouse/pull/30852
31+ if (!conn .getServerVersion ().check ("[21.6,)" )) {
32+ return ;
33+ }
34+
35+ s .execute (String .format (Locale .ROOT ,
36+ "drop table if exists %1$s; create table %1$s(s String) engine=Memory comment '%2$s'" ,
37+ tableName , tableComment ));
38+ try (ResultSet rs = conn .getMetaData ().getTables (null , "%" , tableName , null )) {
39+ Assert .assertTrue (rs .next ());
40+ Assert .assertEquals (rs .getString ("remarks" ), tableComment );
41+ Assert .assertFalse (rs .next ());
42+ }
43+ }
44+ }
2145}
0 commit comments