@@ -200,23 +200,29 @@ func TestSingleQueryPrepared(t *testing.T) {
200200
201201// Convenience test for debugging a single query. Unskip and set to the desired query.
202202func TestSingleScript (t * testing.T ) {
203- t .Skip ()
203+ // t.Skip()
204204 var scripts = []queries.ScriptTest {
205205 {
206- Name : "AS OF propagates to nested CALLs" ,
207- SetUpScript : []string {},
206+ // https://github.com/dolthub/dolt/issues/9987
207+ Name : "GROUP BY nil pointer dereference in Dispose when Next() never called" ,
208+ SetUpScript : []string {
209+ "CREATE TABLE test_table (id INT PRIMARY KEY, value INT, category VARCHAR(50))" ,
210+ "INSERT INTO test_table VALUES (1, 100, 'A'), (2, 200, 'B'), (3, 300, 'A')" ,
211+ },
208212 Assertions : []queries.ScriptTestAssertion {
209213 {
210- Query : "create procedure create_proc() create table t (i int primary key, j int);" ,
211- Expected : []sql. Row {
212- { types . NewOkResult ( 0 )} ,
213- },
214+ // LIMIT 0 causes the iterator to close without ever calling Next() on groupByIter
215+ // This leaves all buffer elements as nil, causing panic in Dispose()
216+ Query : "SELECT category, SUM(value) FROM test_table GROUP BY category LIMIT 0" ,
217+ Expected : []sql. Row { },
214218 },
215219 {
216- Query : "call create_proc()" ,
217- Expected : []sql.Row {
218- {types .NewOkResult (0 )},
219- },
220+ Query : "SELECT category, COUNT(*) FROM test_table GROUP BY category LIMIT 0" ,
221+ Expected : []sql.Row {},
222+ },
223+ {
224+ Query : "SELECT SUM(value) FROM test_table LIMIT 0" ,
225+ Expected : []sql.Row {},
220226 },
221227 },
222228 },
0 commit comments