@@ -121,6 +121,60 @@ type ScriptTestAssertion struct {
121121// Unlike other engine tests, ScriptTests must be self-contained. No other tables are created outside the definition of
122122// the tests.
123123var ScriptTests = []ScriptTest {
124+ {
125+ // https://github.com/dolthub/go-mysql-server/issues/3216
126+ Name : "UNION ALL with BLOB columns" ,
127+ SetUpScript : []string {
128+ "CREATE TABLE a(name VARCHAR(255), data BLOB)" ,
129+ "CREATE TABLE b(name VARCHAR(255), data BLOB)" ,
130+ "INSERT INTO a VALUES ('a-data', UNHEX('deadbeef'))" ,
131+ "INSERT INTO b VALUES ('b-nodata', NULL)" ,
132+ },
133+ Assertions : []ScriptTestAssertion {
134+ {
135+ Query : "SELECT name, data FROM a UNION ALL SELECT name, data FROM b" ,
136+ Expected : []sql.Row {
137+ {"a-data" , []byte {0xde , 0xad , 0xbe , 0xef }},
138+ {"b-nodata" , nil },
139+ },
140+ },
141+ {
142+ Query : "SELECT name, HEX(data) as data_hex FROM a UNION ALL SELECT name, HEX(data) as data_hex FROM b" ,
143+ Expected : []sql.Row {
144+ {"a-data" , "DEADBEEF" },
145+ {"b-nodata" , nil },
146+ },
147+ },
148+ {
149+ Query : "SELECT name, data FROM a UNION ALL SELECT name, NULL FROM b" ,
150+ Expected : []sql.Row {
151+ {"a-data" , []byte {0xde , 0xad , 0xbe , 0xef }},
152+ {"b-nodata" , nil },
153+ },
154+ },
155+ {
156+ Query : "SELECT name, HEX(data) as data_hex FROM a UNION ALL SELECT name, HEX(NULL) as data_hex FROM b" ,
157+ Expected : []sql.Row {
158+ {"a-data" , "DEADBEEF" },
159+ {"b-nodata" , nil },
160+ },
161+ },
162+ {
163+ Query : "SELECT name, data FROM a UNION ALL SELECT name, UNHEX('') FROM b" ,
164+ Expected : []sql.Row {
165+ {"a-data" , []byte {0xde , 0xad , 0xbe , 0xef }},
166+ {"b-nodata" , []byte {}},
167+ },
168+ },
169+ {
170+ Query : "SELECT name, HEX(data) as data_hex FROM a UNION ALL SELECT name, HEX(UNHEX('')) as data_hex FROM b" ,
171+ Expected : []sql.Row {
172+ {"a-data" , "DEADBEEF" },
173+ {"b-nodata" , "" },
174+ },
175+ },
176+ },
177+ },
124178 {
125179 // https://github.com/dolthub/dolt/issues/9836
126180 Skip : true ,
0 commit comments