#33602: when use date_hierarchy in admin,  it report a error.   django 3.2.12,
mysql-connector-python8.0.28,  mysql server 8.0.28
-------------------------------------+-------------------------------------
     Reporter:  Eric Pan             |                    Owner:  nobody
         Type:  Bug                  |                   Status:  closed
    Component:  Database layer       |                  Version:  3.2
  (models, ORM)                      |
     Severity:  Normal               |               Resolution:  needsinfo
     Keywords:                       |             Triage Stage:
                                     |  Unreviewed
    Has patch:  0                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------

Comment (by Eric Pan):

 the error message is:

 django.db.utils.DatabaseError: (1292, "1292: Incorrect datetime value:
 '%Y-01-01'", None)

 and the sql text sent to mysql db is  'SELECT DISTINCT
 CAST(DATE_FORMAT([table name], '%%Y-01-01') AS DATE) AS `datefield

 it seems the double %%  not be escaped to single % in the final sql text
 sent to mysql.

 I don not know it's the issue of mysql-connector-python  or Django it
 self.


 because the sql was generated in django module.
 \site-packages\django\db\backends\mysql\operations.py line 58

-- 
Ticket URL: <https://code.djangoproject.com/ticket/33602#comment:2>
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/0107017fc9e89a2f-dc848944-9d68-4ff9-adf4-5461f1bc4d53-000000%40eu-central-1.amazonses.com.

Reply via email to