| 8 | |
| 9 | For reference, with the fix, this query goes from: |
| 10 | |
| 11 | {{{ |
| 12 | SELECT (1) AS "a" FROM "aggregation_book" GROUP BY "aggregation_book"."publisher_id", (1) HAVING COUNT("aggregation_book"."isbn") > 1 LIMIT 1 |
| 13 | }}} |
| 14 | |
| 15 | to: |
| 16 | |
| 17 | {{{ |
| 18 | SELECT 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) |
| 22 | I'll try to be diligent with the asserts though, because if the test must work on all backends, even |
| 23 | |
| 24 | {{{ |
| 25 | self.assertIn("SELECT 1 ", sql) |
| 26 | }}} |
| 27 | |
| 28 | isn't good, because we can get SELECT TOP 1 1 (...) instead of SELECT 1 (...) LIMIT 1 |
| 29 | |
| 30 | So perhaps a simple |
| 31 | |
| 32 | {{{ |
| 33 | self.assertNotIn(", (1)", sql) |
| 34 | }}} |
| 35 | |
| 36 | would 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) |