Index: core/management.py
===================================================================
--- core/management.py	(revision 5525)
+++ core/management.py	(working copy)
@@ -424,12 +424,13 @@
     # Find custom SQL, if it's available.
     sql_files = [os.path.join(app_dir, "%s.%s.sql" % (opts.object_name.lower(), settings.DATABASE_ENGINE)),
                  os.path.join(app_dir, "%s.sql" % opts.object_name.lower())]
+    comment_re = re.compile(r"^((?:'[^']*'|[^'])*?)--.*$")
     for sql_file in sql_files:
         if os.path.exists(sql_file):
             fp = open(sql_file, 'U')
             for statement in statements.split(fp.read()):
                 # Remove any comments from the file
-                statement = re.sub(r"--.*[\n\Z]", "", statement)
+                statement = comment_re.sub(r"\1", statement)
                 if statement.strip():
                     output.append(statement + ";")
             fp.close()
