Opened 9 years ago

Closed 9 years ago

#2469 closed defect (fixed) sqlclear outputs illegal constraint names

Reported by: anonymous Owned by: adrian
Component: Tools Version: master
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: UI/UX:


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

I suspect this to be Postgres specific.

Change History (6)

comment:1 Changed 9 years ago by cerealito@…

  • Keywords postgres constraint added
  • Version changed from magic-removal to SVN

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 Changed 9 years ago by mtredinnick

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

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

comment:3 Changed 9 years ago by mtredinnick

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 Changed 9 years ago by cerealito@…

  • Keywords reset added
  • Resolution fixed deleted
  • Status changed from closed to 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 Changed 9 years ago by mtredinnick

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 Changed 9 years ago by mtredinnick

  • Resolution set to fixed
  • Status changed from reopened to closed

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

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