#27632: Oracle backend fails to execute a query with an aggregation that 
contains
an expression in the GROUP BY.
-------------------------------------+-------------------------------------
     Reporter:  Josh Smeaton         |                    Owner:  felixxm
         Type:  Bug                  |                   Status:  assigned
    Component:  Database layer       |                  Version:  master
  (models, ORM)                      |
     Severity:  Normal               |               Resolution:
     Keywords:  oracle               |             Triage Stage:  Accepted
    Has patch:  0                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------
Changes (by felixxm):

 * owner:  nobody => felixxm
 * status:  new => assigned


Comment:

 IMO we can avoid this error (`"ORA-00979: not a GROUP BY expression"`) by
 omitting adding `Value` expression (bind parameters) in
 `CombinedExpression` to group by clause. Query without it i.e.

 {{{#!sql
 SELECT
   ("AGGREGATION_REGRESS_BOOK"."PRICE" * :arg0) AS "DISCOUNT_PRICE",
   SUM(("AGGREGATION_REGRESS_BOOK"."PRICE" * :arg1)) AS "SUM_DISCOUNT"
 FROM "AGGREGATION_REGRESS_BOOK"
 GROUP BY
   "AGGREGATION_REGRESS_BOOK"."PRICE",
   "AGGREGATION_REGRESS_BOOK"."NAME"
 ORDER BY "AGGREGATION_REGRESS_BOOK"."NAME" ASC
 }}}

 will work this same as:

 {{{#!sql
 SELECT
   ("AGGREGATION_REGRESS_BOOK"."PRICE" * :arg0) AS "DISCOUNT_PRICE",
   SUM(("AGGREGATION_REGRESS_BOOK"."PRICE" * :arg1)) AS "SUM_DISCOUNT"
 FROM "AGGREGATION_REGRESS_BOOK"
 GROUP BY
   "AGGREGATION_REGRESS_BOOK"."PRICE" * :arg2,
   "AGGREGATION_REGRESS_BOOK"."NAME"
 ORDER BY "AGGREGATION_REGRESS_BOOK"."NAME" ASC
 }}}.

--
Ticket URL: <https://code.djangoproject.com/ticket/27632#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 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/066.7b26572653bd1f6f582f78d39915e689%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to