Ticket #447 (closed defect: fixed)
added columns get wrong default value in SQLite
|Reported by:||carl@…||Owned by:||andrew|
(I'm positive I've seen this discussed before somewhere, but for the life of me can't find a ticket in Trac, so...)
If you add a column in SQLite, the column gets its own name set as the default value for all existing rows. Which is obviously wrong.
The reason is that the current implementation of sqlite3.DatabaseOperations?._copy_table doesn't correctly handle fields that exist in the destination (new) table but not in the source (old) table; it naively tries to select those fields from the old table, but since the field doesn't exist there, the field name itself is selected as a string.