SQLite Forum

Defense against dark arts doc pitfall: ALTER TABLE RENAME COLUMN requires function arg limit > 8
I just ran into a weird behavior in a rarely-run "upgrade database schema" script here: an `ALTER TABLE RENAME COLUMN` call was resulting in [`SQLITE_ERROR`][0] (SQL logic error) with a rather obscure verbose message:


too many arguments on function sqlite_rename_column in "UPDATE "main".sqlite_master SET sql = sqlite_rename_column(sql, type, name, 'main', 'MYTABLE', 2, 'MYCOLUMN', 0, 0) WHERE name NOT LIKE 'sqliteX_%' ESCAPE 


I eventually traced it to the `-DSQLITE_MAX_FUNCTION_ARG=8` option I set for my local build of the SQLite shell, which my upgrade script wraps. I used that value [at the docs' behest][1] (ยง1.1.2) but it seems a value of 9 is needed to allow my particular case to work.

I'm not sure whether this post suffices to document the problem or if the docs should be changed somehow:

* Higher recommendation? 
* Is 9 enough, or do more complicated cases require a higher value?
* Or, just warn about the interaction with `ALTER TABLE RENAME COLUMN`?

[0]: https://sqlite.org/rescode.html#error
[1]: https://www.sqlite.org/security.html