Opened 19 years ago
Closed 19 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 , 19 years ago
| Keywords: | postgres constraint added |
|---|---|
| Version: | magic-removal → SVN |
comment:2 by , 19 years ago
| Resolution: | → fixed |
|---|---|
| Status: | new → closed |
comment:3 by , 19 years ago
comment:4 by , 19 years ago
| Keywords: | reset added |
|---|---|
| Resolution: | fixed |
| Status: | closed → reopened |
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 , 19 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 , 19 years ago
| Resolution: | → fixed |
|---|---|
| Status: | reopened → closed |
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.