This behavior seems to happen in both stock standard 3.7.7.1 on 32-bit Windows XP and my customized 3.7.8 on Solaris 9 (Sparc). Here's the capture from Windows:
D:\peter\sqlite-shell-win32-x86-3070701>sqlite3 this_is_a_new_db.db SQLite version 3.7.7.1 2011-06-28 17:39:05 Enter ".help" for instructions Enter SQL statements terminated with a ";" sqlite> pragma encoding = "UTF-16be"; sqlite> create virtual table rt using rtree (i,x1,x2,y1,y2); sqlite> pragma encoding; UTF-16be sqlite> .tables rt rt_node rt_parent rt_rowid sqlite> alter table rt rename to rx; sqlite> .tables _node _parent _rowid rx sqlite> However, if I choose UTF-16le instead, it produces a different, although equally incorrect result: D:\peter\sqlite-shell-win32-x86-3070701>sqlite3 this_is_a_new_db.db SQLite version 3.7.7.1 2011-06-28 17:39:05 Enter ".help" for instructions Enter SQL statements terminated with a ";" sqlite> pragma encoding = "UTF-16le"; sqlite> create virtual table rt using rtree (i,x1,x2,y1,y2); sqlite> pragma encoding; UTF-16le sqlite> .tables rt rt_node rt_parent rt_rowid sqlite> alter table rt rename to rx; sqlite> .tables r_node r_parent r_rowid rx sqlite> But it works correctly with UTF-8: D:\peter\sqlite-shell-win32-x86-3070701>sqlite3 this_is_a_new_db.db SQLite version 3.7.7.1 2011-06-28 17:39:05 Enter ".help" for instructions Enter SQL statements terminated with a ";" sqlite> pragma encoding = "UTF-8"; sqlite> create virtual table rt using rtree (i,x1,x2,y1,y2); sqlite> pragma encoding; UTF-8 sqlite> .tables rt rt_node rt_parent rt_rowid sqlite> alter table rt rename to rx; sqlite> .tables rx rx_node rx_parent rx_rowid sqlite> I did a little debugging on Solaris, and it appeared that in the UTF-16be case, a zero-length string is being passed in as the 2nd argument (zNewName) for rtreeRename(). If I had to guess, given the difference in behavior between UTF-16le and UTF-16be, I'd say when the database is in UTF-16, that the virtual table interface is passing a UTF-16 string into the xRename function for the zNewName argument. Given that zNewName is declared as a pointer to const char, I can see why rtreeRename isn't expecting this. I suspect that someone familiar with the parser could probably figure out what the problem is in a few minutes. In the meantime I can avoid this problem by creating my databases using UTF-8 (they're being created in UTF-16 right now because I'm calling sqlite3_open16(), which seemed natural as the level of code above mine was supplying the database name in UTF-16, but I can change that). Best, Peter _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users