SQLite Forum

Error message from xConnect of eponymous table

Error message from xConnect of eponymous table

(1) By Max (Maxulite) on 2021-05-21 14:12:52 [link]

I may be wrong, but it looks like pzErr message returned from xConnect call to an eponymous table is not propagated to the original caller, so the error message is "no such table: ..." even if my returned pzErr is not empty or null. 

I'm not sure about my findings because pragma_table_info when called with invalid database (second parameter) reports another error ('unknown database') so this eponymous table is able somehow to report different errors.

I must admit that my wish to change it is a kind of exotic since from the very nature of eponymous tables (no parameters when created) they rarely should produce errors. But in my case I use the data from the database itself. Delaying errors for later (for example, cursor handling moment) is not possible because the schema depends on the data found.

(2) By Max (Maxulite) on 2021-05-26 09:14:57 in reply to 1

Some additional info to this issue.

I checked the source for pragma_table_info logic and apparrently pragmaVtabFilter transforms the table-valued originated data of pragma_table_info(table, schema) into PRAGMA shema.table_info(table) and just returns the error from the PRAGMA query as it is("unknown database..."). So it is very likely that no error reporting on xConnect level is involved here. 

As for my instances of the issue, I made a test with one of my virtual tables that is eponymous (enabled) virtual table (xCreate = xConnect). A fresh (create virtual) table was created. Then I closed the file and made a temporal unconditional error in xConnect handler source with my error message returned. 
The results are

  *  For <u>select * from an_unique_virtual_table_name(...</u> I got my error (expected)
  *  For <u>select * from module_name(...</u> (eponymous mode) I got "no such table {module_name}" error, but in the debugger I saw that my message was indeed passed to sqlite.