@@ -98,3 +98,35 @@ func TestStdMap(t *testing.T) {
98
98
})
99
99
}
100
100
}
101
+
102
+ func TestStdInsertNilMap (t * testing.T ) {
103
+ dsns := map [string ]clickhouse.Protocol {"Native" : clickhouse .Native , "Http" : clickhouse .HTTP }
104
+ useSSL , err := strconv .ParseBool (clickhouse_tests .GetEnv ("CLICKHOUSE_USE_SSL" , "false" ))
105
+ require .NoError (t , err )
106
+ for name , protocol := range dsns {
107
+ t .Run (fmt .Sprintf ("%s Protocol" , name ), func (t * testing.T ) {
108
+ conn , err := GetStdDSNConnection (protocol , useSSL , url.Values {})
109
+ require .NoError (t , err )
110
+ if ! CheckMinServerVersion (conn , 21 , 9 , 0 ) {
111
+ t .Skip (fmt .Errorf ("unsupported clickhouse version" ))
112
+ return
113
+ }
114
+ const ddl = `
115
+ CREATE TABLE test_map_nil (
116
+ Col1 Map(String, UInt64)
117
+ ) Engine MergeTree() ORDER BY tuple()
118
+ `
119
+ defer func () {
120
+ conn .Exec ("DROP TABLE test_map_nil" )
121
+ }()
122
+ _ , err = conn .Exec (ddl )
123
+ require .NoError (t , err )
124
+ scope , err := conn .Begin ()
125
+ require .NoError (t , err )
126
+ batch , err := scope .Prepare ("INSERT INTO test_map_nil" )
127
+ require .NoError (t , err )
128
+ _ , err = batch .Exec (nil )
129
+ assert .ErrorContains (t , err , " converting <nil> to Map(String, UInt64) is unsupported" )
130
+ })
131
+ }
132
+ }
0 commit comments