## Summary
<!--Explain briefly what goes wrong and explain why you believe this is a bug and not the intended behavior of SQLite (if it is not a crash).-->**No review yet**

## Minimized query

```sql
PRAGMA fullfsync;
PRAGMA wal_autocheckpoint;
PRAGMA cache_spill;
.timer on
CREATE TABLE T (
  a INTEGER,
  b REAL,
  c REAL
);
INSERT INTO T VALUES (1,2.0,10.5), (1,-3.5,20.25), (2,9e999,-1.0);
WITH d AS (SELECT a,SUM(b*c) AS e FROM T GROUP BY a) SELECT * FROM d;
CREATE  INDEX IF NOT EXISTS idx_T_9600 ON T(lower(b)) WHERE b > 0;
```

## Actual output

```sql
SQLite version 3.39.0 2022-05-10 23:28:12
Enter ".help" for usage hints.
sqlite> 0
sqlite> 1000
sqlite> 483
sqlite> sqlite>    ...>    ...>    ...>    ...> Run Time: real 0.000 user 0.000212 sys 0.000000
sqlite> Run Time: real 0.000 user 0.000026 sys 0.000000
sqlite> 1|-49.875
2|-Inf
Run Time: real 0.000 user 0.000060 sys 0.000000
sqlite> Run Time: real 0.000 user 0.000075 sys 0.000000
sqlite>
```

## Expectation

```sql
SQLite version 3.51.1 2025-11-28 17:28:25
Enter ".help" for usage hints.
sqlite> 0
sqlite> 1000
sqlite> 483
sqlite> sqlite> (x1...> (x1...> (x1...> (x1...> Run Time: real 0.000076 user 0.000088 sys 0.000000
sqlite> Run Time: real 0.000013 user 0.000014 sys 0.000000
sqlite> 1|-49.875
2|-Inf
Run Time: real 0.000032 user 0.000032 sys 0.000000
sqlite> Run Time: real 0.000069 user 0.000069 sys 0.000000
sqlite>
```

## Flag

```
-interactive
```

