SQLite Forum

Custom error messages for required table-valued function parameter
To enforce one or more required parameters for a table-valued function in the
current code, I think you should have xBestIndex return SQLITE_OK with a very
large `estimatedCost` if the parameters are missing, together with an `idxNum`
and/or `idxStr` that indicates that the parameters are missing.  Then, raise
an error in xFilter if it ever sees an `idxNum` or `idxStr` that indicates
missing parameters.

This is suboptimal in that it delays the error until run-time.  The error
might not even occur if a WHERE clause constraint prevents the
table-valued function from ever being referenced.  In a UNION ALL query,
you might get several rows of output before the error is raised.  Better
solutions will be forthcoming in a future release.