Hello developers,
We found an assertion failure in SQLite version 3.37.0 2021-11-06 20:25:29 **with --enable-debug**.
The test case is as follows:
```
CREATE TABLE t0(a);
SELECT a FROM t0 LEFT JOIN (SELECT a AS b FROM t0) AS t1 WHERE (a,1)=(SELECT 2,2 UNION SELECT total(b),max(b) OVER(ORDER BY b) ORDER BY 2 DESC) AND b=4 ORDER BY b DESC;
```
which causes:
> sqlite3.c: char sqlite3TableColumnAffinity(const Table *, int): Assertion `iCol\<pTab->nCol' failed.
in line:
> assert( iCol\<pTab->nCol );
Bisecting shows the issue may be related to [check-in 0d11d777c8](https://sqlite.org/src/info/0d11d777c8).
**For other readers, this is not necessarily a problem in release builds.**
The version with no debug enabled gives:
> Error: in prepare, 2 columns assigned 1 values (1)
Hope the problem will be handled properly :)