Opened 18 years ago

Closed 18 years ago

#2469 closed defect (fixed)

manage.py sqlclear outputs illegal constraint names

Reported by: anonymous Owned by: Adrian Holovaty
Component: Tools Version: dev
Severity: major Keywords: postgres constraint reset
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

On Postgres with 0.95 rev. 3512, the constraint names for referential integrity used my manage.py sqlclear differ from the names generated by sqlall. Therefore manage.py reset fails.

I suspect this to be Postgres specific.

Change History (6)

comment:1 by cerealito@…, 18 years ago

Keywords: postgres constraint added
Version: magic-removalSVN

Using svn version 0.96-pre and postgres present a similar problem: the constraint names generated by sql <appname> are strange (package_id_refs_id_143cbb4b) and indeed different from those generated by sqlreset <appname> (package_id_referencing_package_id), making sqlreset fail.

comment:2 by Malcolm Tredinnick, 18 years ago

Resolution: fixed
Status: newclosed

(In [3543]) Fixed #2469 -- Made the "drop index" constraint names match those we create in the first place.

comment:3 by Malcolm Tredinnick, 18 years ago

The initial report is either fixed by [3543] or a duplicate of #2493, I suspect. If neither of those cases apply, please reopen and paste the constraint names we are trying to drop and what they really are in the database.

comment:4 by cerealito@…, 18 years ago

Keywords: reset added
Resolution: fixed
Status: closedreopened

I've just updated to 3543. Although the name of the constraints changed from the previous version, I'm still having reset <appname> failing due to different names between the drop sentence and the actual name in the database. The constraint names trying to be droped:

The full error:
ERROR:  constraint "id_refs_package_id_72f9d851" does not exist
...
ERROR:  constraint "id_refs_description_id_53d6190a" does not exist
...

the actual names in the database generated by syncdb are:
package_id_refs_id_72f9d851 and description_id_refs_id_53d6190a

The models were defined as following:

class Description(models.Model):
    lang = models.ForeignKey(Lang)
    package = models.ForeignKey(Package)
    description = models.TextField()
...
class ImageInDescription(models.Model):
    description = models.ForeignKey(Description, edit_inline=models.STACKED, num_in_admin=3)
    image = models.ForeignKey(Image, core=True)
...

comment:5 by Malcolm Tredinnick, 18 years ago

Oh, I'm so sorry. You're right. :-(

I accidently only tested this on a silly model with symmetrical names, so didn't notice the difference. Fixing now.

comment:6 by Malcolm Tredinnick, 18 years ago

Resolution: fixed
Status: reopenedclosed

(In [3547]) Fixed #2469 -- Fixed the constraint names in the sqlreset output (again!).

Note: See TracTickets for help on using tickets.
Back to Top