You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
dbRemoveTable() fails on SQLite with 'near "TRUNCATE": syntax error' and leaves the table in place #348
DBI::dbRemoveTable() on a DatabaseConnector SQLite connection fails and does not drop the table. The method sends a hard-coded TRUNCATE TABLE statement to the database without translating it, and SQLite has no TRUNCATE TABLE statement. Since the TRUNCATE runs before the DROP TABLE, the error aborts the call and the table remains.
The same happens when passing a temp table name (e.g. dbRemoveTable(connection, "#temp"), as used in extras/TestCode.R): the # prefix is sent to the database verbatim, which SQLite and DuckDB reject with a parser error.
In DatabaseConnector 6.x dbRemoveTable() translated its statements, so TRUNCATE TABLE became DELETE FROM on SQLite. Since the 7.0 DBI refactoring (commit 5969f2f "Removing all translation from DBI functions") the method sends the raw statements. dropEmulatedTempTables() in R/Sql.R runs the same TRUNCATE TABLE ...; DROP TABLE ...; pattern but translates it with SqlRender::translate() first, so it keeps working on SQLite.
Activity