Fix(?) model insert handling when autcommit=True for PostgreSQL <= 8.1
|Reported by:||Malcolm Tredinnick||Owned by:||Malcolm Tredinnick|
|Component:||Database layer (models, ORM)||Version:||master|
|Has patch:||yes||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
Need to wrap some isolation level changes around inserts when using older PostgreSQL versions so that we can reliably return the last insert ID. This is necessary because we use that value to set the primary key attribute on the model instance and there's potentially no other way to get the information for some models (with no other unique constraints).
When this is fixed,
settings.DATABASE_OPTIONS[autocommit] = True can be an option again for those server versions.
Change History (15)
comment:1 Changed 8 years ago by
|Patch needs improvement:||unset|
|Triage Stage:||Unreviewed → Accepted|