Skip to content
Prev 719 / 1559 Next

dbWriteTable() is renaming the 'end' column

I presume this is about dbWriteTable in package DBI, and also RSQLite, 
but neither are mentioned and the 'example' fails to run as written.
On Tue, 29 Sep 2009, Herv? Pag?s wrote:

            
Without telling us *which* ANSI SQL standard this is unclear, but I 
believe that it is a false claim.  It seems so do the authors of 
MySQL, who have an ANSI_QUOTE mode using " to quote identifiers.  As I 
know from RODBC, this is one of those areas of differences between 
actual SQL engines, and one which ODBC does not attempt to paper over.

See also 
http://www.mail-archive.com/sqlite-users at sqlite.org/msg09583.html
-- so it looks like backquotes were added to SQLite in 2005, long 
after the design of DBI/RSQLite, and as a non-ANSI extension.

RODBC successfully uses double quotes for identifiers with SQLite, and 
the RODBC version of your example works as you expected.
But DBI::dbWriteTable() does neither of these: it calls the method 
in the backend, which in the case of RSQLite is sqliteWriteTable(). 
That calls RSQLite::dbBuildTableDefinition() to make the CREATE TABLE 
query, and that calls DBI::make.db.names(), which is a generic with a 
method in RSQLite.

So the correct subject of your scorn would seem to be 
RSQLite::dbBuildTableDefinition() and its lack of documentation. As I 
have argued earlier, I think that the solution has to be specific to 
the backend.