#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.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/064.51a7c310ad4473ea8d480e1dd6d4478c%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to