We're using ORM to do unit testing, so we're mocking up the commit
message to do nothing, basically creating a long transaction that's
rolled back at the end of the test.  However, I am running into the
following problem.  Assume we've mapped a table to class MyTable with
a varchar `name' and a boolean `flag' that defaults to false:

    Session.add(MyTable(name="Bob"))
    bob = Session.query(MyTable).filter_by(name="Bob").first()
    bob.flag = True

    Session.query(MyTable).filter_by(name="Bob").first()
    Session.delete(bob)

    # At this point, Bob does not exist and doing a query *will* fail
within the transaction
    Session.add(MyTable(name="Bob"))
    bob = Session.query(MyTable).filter_by(name="Bob").first()
    assert_equals(bob.flag, False)

This now fails with bob.flag still being set to True from the previous
update, even though the default value in the DB is set to be False by
default (and works correctly on the initial insert).  Running this
with commits turned on does not run into this problem.

Before submitting a bug, I want to make sure there's not a config
setting somewhere that we're missing.  We are running this against
postgresql 8.4 with sqlalchemy 0.6.

Thank you!

Andrew

-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to sqlalch...@googlegroups.com.
To unsubscribe from this group, send email to 
sqlalchemy+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en.

Reply via email to