SQLite Forum

Custom error messages for required table-valued function parameter
<blockquote>AFAICT SQLite builds an array of all possible constraints based on the query and will then set the "usable" field to reflect those available for the specific query plan.</blockquote>

Sounds reasonable.I just read the Dan's reply and one phrase in it  

<blockquote>If the required parameter is not present in aConstraint[] at all, return SQLITE_ERROR and an error message.</blockquote>

indeed assumes that the array is fixed and only "usable" fields are changing. If it's the case then one really can compare the array set (not looking at the usable field) with the required set and return the error immediately if they don't match. But the docs also contains the phrase

<blockquote>While compiling a single SQL query, the SQLite core might call xBestIndex multiple times with different settings in sqlite3_index_info</blockquote>
and this implies (at least for me) that the column set may change during a single xBestIndex session (multiply calls), so one can not rely on this assumption