fixture loading of M2M fields fails for child ids greater than 9
|Reported by:||adrian_nye||Owned by:||nobody|
|Has patch:||no||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
Loading data in a JSON file that includes data for both models involved in a M2M relationship,
child ids up to 9 work fine, 10 or greater cause an error on MySQL or Postgres
psycopg2.IntegrityError: insert or update on table "entity_person_address" violates foreign key constraint "entity_person_address_address_id_fkey"
DETAIL: Key (address_id)=(0) is not present in table "entity_address".
Cannot add or update a child row: a foreign key constraint fails - tixsa.entity_person_telephone CONSTRAIN telephone_id_refs_id_92398a FOREIGN KEY telephone_id REFERENCES entity_telephone id
To see problem, use the attached model file and attached initial_data.json. You'll see the errors above. Then search for an id of "10" and change it to "1" and the problem goes away.
Change History (6)
comment:1 Changed 7 years ago by
|Patch needs improvement:||unset|
|Status:||new → closed|