zzzeek / test_sqlalchemy

0 stars 0 forks source link

support empty inserts on very old SQLite versions without DEFAULT VALUES #1006

Closed sqlalchemy-bot closed 14 years ago

sqlalchemy-bot commented 16 years ago

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

sqlalchemy-bot commented 16 years ago

Anonymous wrote:


patch to fix empty insert on sqlite

sqlalchemy-bot commented 16 years ago

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.

sqlalchemy-bot commented 14 years ago

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.

sqlalchemy-bot commented 15 years ago

Michael Bayer (zzzeek) wrote:


supporting old versions of sqlite is a nice to have at this point.

sqlalchemy-bot commented 14 years ago

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.

sqlalchemy-bot commented 16 years ago

Changes by Anonymous: set attachment to "sqlite.percious.patch.diff"

sqlalchemy-bot commented 16 years ago

Changes by jek (jek): changed priority from "critical" to "major"

sqlalchemy-bot commented 14 years ago

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"

sqlalchemy-bot commented 15 years ago

Changes by Michael Bayer (zzzeek): changed milestone from "0.4.xx" to "blue sky"