## 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
.changes on
PRAGMA reverse_unordered_selects = ON;
PRAGMA temp_store = '2';
PRAGMA application_id =  ;
.progress 1
PRAGMA encoding=UTF16le;
CREATE TABLE tkt3376(a COLLATE nocase PRIMARY KEY);
INSERT INTO tkt3376 VALUES('abc');
INSERT INTO tkt3376 VALUES('ABX');
SELECT DISTINCT a FROM tkt3376;

UPDATE tkt3376 SET a = NULL WHERE 1;
INSERT OR REPLACE INTO tkt3376 VALUES ('');
VACUUM;
```

## Actual output

```sql
changes: 0   total_changes: 0
changes: 0   total_changes: 0
changes: 0   total_changes: 0
Progress 1
Progress 2
Progress 3
changes: 0   total_changes: 0
Progress 4
Progress 5
Progress 6
Progress 7
Progress 8
Progress 9
Progress 10
Progress 11
Progress 12
Progress 13
Progress 14
Progress 15
Progress 16
Progress 17
Progress 18
Progress 19
Progress 20
Progress 21
Progress 22
Progress 23
Progress 24
Progress 25
Progress 26
Progress 27
Progress 28
Progress 29
Progress 30
Progress 31
Progress 32
Progress 33
Progress 34
Progress 35
Progress 36
Progress 37
Progress 38
Progress 39
Progress 40
Progress 41
Progress 42
Progress 43
Progress 44
Progress 45
Progress 46
Progress 47
Progress 48
Progress 49
Progress 50
Progress 51
Progress 52
Progress 53
Progress 54
Progress 55
Progress 56
Progress 57
Progress 58
Progress 59
Progress 60
Progress 61
Progress 62
Progress 63
Progress 64
Progress 65
Progress 66
Progress 67
Progress 68
Progress 69
Progress 70
Progress 71
Progress 72
Progress 73
Progress 74
Progress 75
Progress 76
Progress 77
Progress 78
Progress 79
Progress 80
Progress 81
Progress 82
changes: 0   total_changes: 0
Progress 83
Progress 84
Progress 85
Progress 86
Progress 87
Progress 88
Progress 89
Progress 90
Progress 91
Progress 92
Progress 93
Progress 94
Progress 95
Progress 96
Progress 97
Progress 98
changes: 1   total_changes: 1
Progress 99
Progress 100
Progress 101
Progress 102
Progress 103
Progress 104
Progress 105
Progress 106
Progress 107
Progress 108
Progress 109
Progress 110
Progress 111
Progress 112
Progress 113
Progress 114
changes: 1   total_changes: 2
Progress 115
Progress 116
Progress 117
Progress 118
Progress 119
Progress 120
Progress 121
Progress 122
Progress 123
Progress 124
abc
Progress 125
Progress 126
Progress 127
Progress 128
Progress 129
ABX
Progress 130
Progress 131
changes: 1   total_changes: 2
Progress 132
Progress 133
Progress 134
Progress 135
Progress 136
Progress 137
Progress 138
Progress 139
Progress 140
Progress 141
Progress 142
Progress 143
Progress 144
Progress 145
Progress 146
Progress 147
Progress 148
Progress 149
Progress 150
Progress 151
Progress 152
Progress 153
Progress 154
Progress 155
Progress 156
Progress 157
Progress 158
Progress 159
Progress 160
Progress 161
Progress 162
Progress 163
Progress 164
Progress 165
Progress 166
Progress 167
Progress 168
Progress 169
Progress 170
Progress 171
Progress 172
changes: 2   total_changes: 4
Progress 173
Progress 174
Progress 175
Progress 176
Progress 177
Progress 178
Progress 179
Progress 180
Progress 181
Progress 182
Progress 183
Progress 184
Progress 185
Progress 186
Progress 187
Progress 188
changes: 1   total_changes: 5
Progress 189
Progress 190
Progress 191
Progress 192
Progress 193
Progress 194
Progress 195
Progress 196
Progress 197
Progress 198
Progress 199
Progress 200
Progress 201
Progress 202
Progress 203
Progress 204
Progress 205
Progress 206
Progress 207
Progress 208
Progress 209
Progress 210
Progress 211
Progress 212
Progress 213
Progress 214
Progress 215
Progress 216
Progress 217
Progress 218
Progress 219
Progress 220
Progress 221
Progress 222
Progress 223
Progress 224
Progress 225
Progress 226
Progress 227
Progress 228
Progress 229
Progress 230
Progress 231
Progress 232
Progress 233
Progress 234
Progress 235
Progress 236
Progress 237
Progress 238
Progress 239
Progress 240
Progress 241
Progress 242
Progress 243
Progress 244
Progress 245
Progress 246
Progress 247
Progress 248
Progress 249
Progress 250
Progress 251
Progress 252
Progress 253
Progress 254
Progress 255
Progress 256
Progress 257
Progress 258
Progress 259
Progress 260
Progress 261
Progress 262
Progress 263
Progress 264
Progress 265
Progress 266
Progress 267
Progress 268
Progress 269
Progress 270
Progress 271
Progress 272
Progress 273
Progress 274
Progress 275
Progress 276
Progress 277
Progress 278
Progress 279
Progress 280
Progress 281
Progress 282
Progress 283
Progress 284
Progress 285
Progress 286
Progress 287
Progress 288
Progress 289
Progress 290
Progress 291
Progress 292
Progress 293
Progress 294
Progress 295
Progress 296
Progress 297
Progress 298
Progress 299
Progress 300
Progress 301
Progress 302
Progress 303
Progress 304
Progress 305
Progress 306
Progress 307
Progress 308
Progress 309
Progress 310
Progress 311
Progress 312
Progress 313
Progress 314
Progress 315
Progress 316
Progress 317
Progress 318
Progress 319
Progress 320
Progress 321
Progress 322
Progress 323
Progress 324
Progress 325
Progress 326
Progress 327
Progress 328
Progress 329
Progress 330
Progress 331
Progress 332
Progress 333
Progress 334
Progress 335
Progress 336
Progress 337
Progress 338
Progress 339
Progress 340
Progress 341
Progress 342
Progress 343
Progress 344
Progress 345
Progress 346
Progress 347
Progress 348
Progress 349
Progress 350
Progress 351
Progress 352
Progress 353
Progress 354
Progress 355
Progress 356
Progress 357
Progress 358
Progress 359
Progress 360
Progress 361
Progress 362
Progress 363
Progress 364
Progress 365
Progress 366
Progress 367
Progress 368
Progress 369
Progress 370
Progress 371
Progress 372
Progress 373
Progress 374
Progress 375
Progress 376
Progress 377
Progress 378
Progress 379
Progress 380
Progress 381
Progress 382
Progress 383
Progress 384
Progress 385
Progress 386
Progress 387
Progress 388
Progress 389
Progress 390
Progress 391
Progress 392
Progress 393
Progress 394
Progress 395
Progress 396
Progress 397
Progress 398
Progress 399
Progress 400
Progress 401
Progress 402
Progress 403
Progress 404
Progress 405
Progress 406
Progress 407
Progress 408
Progress 409
Progress 410
Progress 411
Progress 412
Progress 413
Progress 414
changes: 1   total_changes: 5
```

## Expectation

```sql
changes: 0   total_changes: 0
changes: 0   total_changes: 0
changes: 0   total_changes: 0
Progress 1
Progress 2
Progress 3
Progress 4
changes: 0   total_changes: 0
Progress 5
Progress 6
Progress 7
Progress 8
Progress 9
Progress 10
Progress 11
Progress 12
Progress 13
Progress 14
Progress 15
Progress 16
Progress 17
Progress 18
Progress 19
Progress 20
Progress 21
Progress 22
Progress 23
Progress 24
Progress 25
Progress 26
Progress 27
Progress 28
Progress 29
Progress 30
Progress 31
Progress 32
Progress 33
Progress 34
Progress 35
Progress 36
Progress 37
Progress 38
Progress 39
Progress 40
Progress 41
Progress 42
Progress 43
Progress 44
Progress 45
Progress 46
Progress 47
Progress 48
Progress 49
Progress 50
Progress 51
Progress 52
Progress 53
Progress 54
Progress 55
Progress 56
Progress 57
Progress 58
Progress 59
Progress 60
Progress 61
Progress 62
Progress 63
Progress 64
Progress 65
Progress 66
Progress 67
Progress 68
Progress 69
Progress 70
Progress 71
Progress 72
Progress 73
Progress 74
Progress 75
Progress 76
Progress 77
Progress 78
Progress 79
Progress 80
Progress 81
Progress 82
Progress 83
Progress 84
Progress 85
changes: 0   total_changes: 0
Progress 86
Progress 87
Progress 88
Progress 89
Progress 90
Progress 91
Progress 92
Progress 93
Progress 94
Progress 95
Progress 96
Progress 97
Progress 98
Progress 99
Progress 100
Progress 101
changes: 1   total_changes: 1
Progress 102
Progress 103
Progress 104
Progress 105
Progress 106
Progress 107
Progress 108
Progress 109
Progress 110
Progress 111
Progress 112
Progress 113
Progress 114
Progress 115
Progress 116
Progress 117
changes: 1   total_changes: 2
Progress 118
Progress 119
Progress 120
Progress 121
Progress 122
Progress 123
Progress 124
Progress 125
Progress 126
Progress 127
abc
Progress 128
Progress 129
Progress 130
Progress 131
Progress 132
ABX
Progress 133
Progress 134
changes: 1   total_changes: 2
Progress 135
Progress 136
Progress 137
Progress 138
Progress 139
Progress 140
Progress 141
Progress 142
Progress 143
Progress 144
Progress 145
Progress 146
Progress 147
Progress 148
Progress 149
Progress 150
Progress 151
Progress 152
Progress 153
Progress 154
Progress 155
Progress 156
Progress 157
Progress 158
Progress 159
Progress 160
Progress 161
Progress 162
Progress 163
Progress 164
Progress 165
Progress 166
Progress 167
Progress 168
Progress 169
Progress 170
Progress 171
Progress 172
Progress 173
Progress 174
Progress 175
changes: 2   total_changes: 4
Progress 176
Progress 177
Progress 178
Progress 179
Progress 180
Progress 181
Progress 182
Progress 183
Progress 184
Progress 185
Progress 186
Progress 187
Progress 188
Progress 189
Progress 190
Progress 191
changes: 1   total_changes: 5
Progress 192
Progress 193
Progress 194
Progress 195
Progress 196
Progress 197
Progress 198
Progress 199
Progress 200
Progress 201
Progress 202
Progress 203
Progress 204
Progress 205
Progress 206
Progress 207
Progress 208
Progress 209
Progress 210
Progress 211
Progress 212
Progress 213
Progress 214
Progress 215
Progress 216
Progress 217
Progress 218
Progress 219
Progress 220
Progress 221
Progress 222
Progress 223
Progress 224
Progress 225
Progress 226
Progress 227
Progress 228
Progress 229
Progress 230
Progress 231
Progress 232
Progress 233
Progress 234
Progress 235
Progress 236
Progress 237
Progress 238
Progress 239
Progress 240
Progress 241
Progress 242
Progress 243
Progress 244
Progress 245
Progress 246
Progress 247
Progress 248
Progress 249
Progress 250
Progress 251
Progress 252
Progress 253
Progress 254
Progress 255
Progress 256
Progress 257
Progress 258
Progress 259
Progress 260
Progress 261
Progress 262
Progress 263
Progress 264
Progress 265
Progress 266
Progress 267
Progress 268
Progress 269
Progress 270
Progress 271
Progress 272
Progress 273
Progress 274
Progress 275
Progress 276
Progress 277
Progress 278
Progress 279
Progress 280
Progress 281
Progress 282
Progress 283
Progress 284
Progress 285
Progress 286
Progress 287
Progress 288
Progress 289
Progress 290
Progress 291
Progress 292
Progress 293
Progress 294
Progress 295
Progress 296
Progress 297
Progress 298
Progress 299
Progress 300
Progress 301
Progress 302
Progress 303
Progress 304
Progress 305
Progress 306
Progress 307
Progress 308
Progress 309
Progress 310
Progress 311
Progress 312
Progress 313
Progress 314
Progress 315
Progress 316
Progress 317
Progress 318
Progress 319
Progress 320
Progress 321
Progress 322
Progress 323
Progress 324
Progress 325
Progress 326
Progress 327
Progress 328
Progress 329
Progress 330
Progress 331
Progress 332
Progress 333
Progress 334
Progress 335
Progress 336
Progress 337
Progress 338
Progress 339
Progress 340
Progress 341
Progress 342
Progress 343
Progress 344
Progress 345
Progress 346
Progress 347
Progress 348
Progress 349
Progress 350
Progress 351
Progress 352
Progress 353
Progress 354
Progress 355
Progress 356
Progress 357
Progress 358
Progress 359
Progress 360
Progress 361
Progress 362
Progress 363
Progress 364
Progress 365
Progress 366
Progress 367
Progress 368
Progress 369
Progress 370
Progress 371
Progress 372
Progress 373
Progress 374
Progress 375
Progress 376
Progress 377
Progress 378
Progress 379
Progress 380
Progress 381
Progress 382
Progress 383
Progress 384
Progress 385
Progress 386
Progress 387
Progress 388
Progress 389
Progress 390
Progress 391
Progress 392
Progress 393
Progress 394
Progress 395
Progress 396
Progress 397
Progress 398
Progress 399
Progress 400
Progress 401
Progress 402
Progress 403
Progress 404
Progress 405
Progress 406
Progress 407
Progress 408
Progress 409
Progress 410
Progress 411
Progress 412
Progress 413
Progress 414
Progress 415
Progress 416
Progress 417
Progress 418
Progress 419
Progress 420
Progress 421
Progress 422
Progress 423
Progress 424
Progress 425
Progress 426
Progress 427
Progress 428
Progress 429
Progress 430
changes: 1   total_changes: 5
```

## Flag

```

```

