Feature #923
Model automatic loading should not work on None values
Description
Currently, the autoloading process in the Record
and VersionedRecord
attempt to do a load when encountering a field that matches a table name, even when the value is None
(a NULL
in SQL). This fails because the current loading works with a direct equality lookup, and nothing equates to NULL in SQL (per specification).
Additionally, in the case where we perform the proper IS NULL
comparison, there is no certainty that this will yield a single result, even if the index on the foreign key is UNIQUE
.
Given the above, and the logical implication that a foreign reference NULL seems to imply that there is none, the auto-loading mechanism should not attempt to look up foreign references where the field value is None
.
Associated revisions
History
#1 Updated by Elmer de Looff over 12 years ago
- Status changed from New to Resolved
- % Done changed from 0 to 70
Applied in changeset 90e76f42bbea.
#2 Updated by Elmer de Looff over 12 years ago
- Assignee changed from Elmer de Looff to Jan Klopper
Jan,
This should now work (or not work to be exact) as intended. Could you verify this?
#3 Updated by Jan Klopper over 12 years ago
- Status changed from Resolved to Closed
- % Done changed from 70 to 100
Fixed.
Works as expected.
Added initial version of the uWeb database model test suite. Fixed and verified behavior to not load foreign records when the reference value is None. This resolves #923.