Opened 7 years ago

Closed 7 years ago

#6713 closed (wontfix)

';' in comments (i.e. lines starting with '--') in sql/mymodel.sql causes error in syncdb

Reported by: alainD Owned by: nobody
Component: Tools Version: master
Severity: Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

for instance the following script :

INSERT INTO "app_model" ("col1", "col2") VALUES (45, 107);
--INSERT INTO "app_model" ("col1", "col2") VALUES (45, 107);
INSERT INTO "app_model" ("col1", "col2") VALUES (45, 107);

causes an error while importing it via syncdb ... because of the commented line (starting with '--')

Change History (1)

comment:1 Changed 7 years ago by jefurii

  • Component changed from Uncategorized to Tools
  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Resolution set to wontfix
  • Status changed from new to closed

This is not a Django problem. If you're using MySQL it's actually a MySQL quirk:

In MySQL, the “-- ” (double-dash) comment style requires the second dash
to be followed by at least one whitespace or control character (such as
a space, tab, newline, and so on). This syntax differs slightly from 
standard SQL comment syntax
Note: See TracTickets for help on using tickets.
Back to Top