Code

Opened 7 years ago

Closed 7 years ago

#5466 closed (invalid)

ForeignKeys with to_field fail to initialize in PostgreSQL

Reported by: David Cramer <dcramer@…> Owned by: nobody
Component: Database layer (models, ORM) Version: other branch
Severity: Keywords: qs-rf
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

The issue seems to arrise when you set a to_field on a ForeignKey. Postgre fails to create the constraint.

This happens in tests/regressiontests/query/ on the Report model

psycopg.ProgrammingError: ERROR: there is no unique constraint matching given k
eys for referenced table "queries_author"


ALTER TABLE "queries_report" ADD CONSTRAINT creator_id_refs_num_33619fc8 FOREIGN
KEY ("creator_id") REF

Attachments (0)

Change History (2)

comment:1 Changed 7 years ago by David Cramer <dcramer@…>

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset

This may be my fault actually, I think I had a conflicting PYTHONPATH

comment:2 Changed 7 years ago by anonymous

  • Resolution set to invalid
  • Status changed from new to closed

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.