support empty inserts on very old SQLite versions without DEFAULT VALUES

Issue #1006 resolved
Former user created an issue

create an sqlite database and engine

table = Table('t', Column('i', Integer)) table.create()

insert(table, values={})

Patch is provided.

Comments (5)

  1. jek

    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.

  2. Michael Trier

    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.

  3. Log in to comment