Opened 6 years ago

Closed 6 years ago

Last modified 6 years ago

#29812 closed Bug (duplicate)

AlterUniqueTogether creates invalid SQL for app with hyphen in name

Reported by: Carl Johnson Owned by: nobody
Component: Migrations Version: 2.1
Severity: Normal Keywords: migrations SQL
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

Background:

I am using Django 2.1.1 with Postgresql. I attempted to create a unique_together field for an app with the name "mencken-admin".

Result:

I got a traceback ending with

django.db.utils.ProgrammingError: syntax error at or near "-"
LINE 1: ...LE "mencken-admin_sitepage" ADD CONSTRAINT mencken-admin_sit...

And then a little carrot (can't type it in the bug system) indicating that the error was the hyphen in mencken-admin_sitepage.

I believe the problem is that the constraint name needs to be escaped somehow.

Change History (2)

comment:1 by Tim Graham, 6 years ago

Component: UncategorizedMigrations
Resolution: duplicate
Status: newclosed
Type: UncategorizedBug

Looks like a duplicate of #29778 which is fixed in Django 2.1.2.

comment:2 by Carl Johnson, 6 years ago

Upgrading fixed it. Thanks.

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