#34771: order_by on annotated field that's not present in values/values_list 
causes
SQL syntax error
-------------------------------------+-------------------------------------
     Reporter:  Yitao Xiong          |                    Owner:  nobody
         Type:  Bug                  |                   Status:  new
    Component:  Database layer       |                  Version:  3.2
  (models, ORM)                      |
     Severity:  Normal               |               Resolution:
     Keywords:  mysql                |             Triage Stage:
                                     |  Unreviewed
    Has patch:  0                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------

Comment (by Natalia Bidart):

 Accepting since as [https://www.w3schools.com/sql/func_mysql_cast.asp per
 docs], it seems that the only valid `datatypes` for a `CAST` call are:

 {{{
 DATE    Converts value to DATE. Format: "YYYY-MM-DD"
 DATETIME        Converts value to DATETIME. Format: "YYYY-MM-DD HH:MM:SS"
 DECIMAL         Converts value to DECIMAL. Use the optional M and D
 parameters to specify the maximum number of digits (M) and the number of
 digits following the decimal point (D).
 TIME    Converts value to TIME. Format: "HH:MM:SS"
 CHAR    Converts value to CHAR (a fixed length string)
 NCHAR   Converts value to NCHAR (like CHAR, but produces a string with the
 national character set)
 SIGNED  Converts value to SIGNED (a signed 64-bit integer)
 UNSIGNED        Converts value to UNSIGNED (an unsigned 64-bit integer)
 BINARY  Converts value to BINARY (a binary string)
 }}}

 Will write a regression test and bisect to confirm whether this would need
 a backport or not.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/34771#comment:6>
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/01070189e5d6e149-a5e0b323-8240-4a9e-95d7-c5ae50d01172-000000%40eu-central-1.amazonses.com.

Reply via email to