[Django] #22665: Creating trigger in custom sql for mySQL failed with 1046 error

5 views
Skip to first unread message

Django

unread,
May 20, 2014, 10:58:09 AM5/20/14
to django-...@googlegroups.com
#22665: Creating trigger in custom sql for mySQL failed with 1046 error
----------------------------------------------+--------------------
Reporter: hudan@… | Owner: nobody
Type: Uncategorized | Status: new
Component: Database layer (models, ORM) | Version: 1.6
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Easy pickings: 0 | UI/UX: 0
----------------------------------------------+--------------------
In file "clothing.mysql.sql" is trigger creation:
{{{#!sql
CREATE TRIGGER ins_laundryflow_clothing BEFORE INSERT ON
laundryflow_clothing FOR EACH ROW
BEGIN
SET NEW.SumWash = NEW.StartWash;
END
}}}
If I run "syncdb", it ends with error:
{{{
Failed to install custom SQL for laundryflow.Clothing model: (1064, "You
have an error in your SQL syntax; check the manual that corresponds to
your MySQL server version for the right syntax to use near '' at line 1")
}}}
If I remove "BEGIN" and "END", everything works:
{{{#!sql
CREATE TRIGGER ins_laundryflow_clothing BEFORE INSERT ON
laundryflow_clothing FOR EACH ROW
SET NEW.SumWash = NEW.StartWash;
}}}

Using "DELIMITER" didn't work at all. On Internet I found, that it's
relevant only in command line MySQL client and shouldn't by use in Python-
MySQL.

BTW> Creating stored procedures has the same problem.

--
Ticket URL: <https://code.djangoproject.com/ticket/22665>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
May 20, 2014, 11:47:22 AM5/20/14
to django-...@googlegroups.com
#22665: Creating trigger in custom sql for mySQL failed with 1046 error
-------------------------------------+-------------------------------------
Reporter: hudan@… | Owner: nobody
Type: Uncategorized | Status: closed
Component: Database layer | Version: 1.6
(models, ORM) | Resolution: invalid
Severity: Normal | Triage Stage:
Keywords: | Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by timo):

* status: new => closed
* needs_docs: => 0
* resolution: => invalid
* needs_tests: => 0
* needs_better_patch: => 0


Comment:

It's not clear to me that this is a bug in Django. Also, initial SQL is
deprecated now that we have migrations in 1.7+ so even if there is a bug,
we probably wouldn't fix it at this point.

--
Ticket URL: <https://code.djangoproject.com/ticket/22665#comment:1>

Reply all
Reply to author
Forward
0 new messages