Changes between Initial Version and Version 1 of Ticket #33655, comment 12


Ignore:
Timestamp:
Apr 25, 2022, 2:10:38 PM (2 years ago)
Author:
Marc Perrin

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #33655, comment 12

    initial v1  
    66
    77)
     8
     9For reference, with the fix, this query goes from:
     10
     11{{{
     12SELECT (1) AS "a" FROM "aggregation_book" GROUP BY "aggregation_book"."publisher_id", (1) HAVING COUNT("aggregation_book"."isbn") > 1 LIMIT 1
     13}}}
     14
     15to:
     16
     17{{{
     18SELECT 1 AS "a" FROM "aggregation_book" GROUP BY "aggregation_book"."publisher_id" HAVING COUNT("aggregation_book"."isbn") > 1 LIMIT 1
     19}}}
     20
     21(with the test default settings i.e. sqlite I guess)
     22I'll try to be diligent with the asserts though, because if the test must work on all backends, even
     23
     24{{{
     25self.assertIn("SELECT 1 ", sql)
     26}}}
     27
     28isn't good, because we can get SELECT TOP 1 1 (...) instead of SELECT 1 (...) LIMIT 1
     29
     30So perhaps a simple
     31
     32{{{
     33self.assertNotIn(", (1)", sql)
     34}}}
     35
     36would be enough (I'm not really fond of your assert about GROUP BY either, because it's not really targeting the GROUP BY clause, it includes everything after it incl. HAVING clause)
Back to Top