Closed sqlalchemy-bot closed 14 years ago
Anonymous wrote:
patch to fix empty insert on sqlite
jek (jek) wrote:
The patch doesn't work:
t = Table('t', m, Column('x', Integer), Column('y', Integer))
t.create()
t.insert().execute()
(OperationalError
) table t has 2 columns but
1 values were supplied
u'INSERT INTO t VALUES(NULL)'
A workaround for older sqlites lacking DEFAULT VALUES is possible. A patch would need to include test cases against sqlite tables created with the different permutations of rowid assignment - pk, pk + autoincrement, etc. to ensure that assigning an explicit NULL still results in autoincrement behavior.
Michael Bayer (zzzeek) wrote:
the fact that DEFAULT VALUES was added to SQLite indicates this was really a sqlite bug, that has been fixed. SQLA doesn't need to support working around this.
Michael Trier (empty) wrote:
Any reason we don't accept the DEFAULT VALUES implementation with tests of course? We lose nothing by solving this problem now even if older versions are unsupported.
Changes by Anonymous: set attachment to "sqlite.percious.patch.diff"
Changes by jek (jek): changed priority from "critical" to "major"
Changes by Michael Bayer (zzzeek): set state to "wontfix"; changed title from "Sqlite inserts with no paremeters fails" to "support empty inserts on very old SQLite versions without DEFAULT VALUES"
Changes by Michael Bayer (zzzeek): changed milestone from "0.4.xx" to "blue sky"
Issue created by Anonymous
create an sqlite database and engine
table = Table('t', Column('i', Integer)) table.create()
insert(table, values={})
Patch is provided.
Attachments: sqlite.percious.patch.diff