summaryrefslogtreecommitdiff
path: root/tests/queries
AgeCommit message (Collapse)Author
2013-10-05Fixed #18414 -- qs.exists() for sliced distinct queriesAnssi Kääriäinen
2013-10-05Simplified a test by using CapturedQueriesContextAnssi Kääriäinen
2013-10-05Improved Query join promotion logicAnssi Kääriäinen
There were multiple cases where join promotion was a bit too aggressive. This resulted in using outer joins where not necessary. Refs #21150.
2013-10-01Fixed #21203 -- resolve_columns fields misalignmentAnssi Kääriäinen
In queries using .defer() together with .select_related() the values and fields arguments didn't align properly for resolve_columns().
2013-09-29Fixed #15786 -- Added a regression test for o2o excludes using F().Simon Charette
The issue was reported against 1.3.x but has been fixed since.
2013-09-29Fixed #21167 - Improved queries.tests.SubqueryTestsMichael Manfre
Improve tests to cover slicing scenarios that could be handled in unique ways by 3rd party database backends.
2013-09-23Fixed #21001 -- Added a regression test for empty string exclusion on Oracle.Simon Charette
The issue was present in 1.4.x but has been reported to be fixed in master. Thanks to @timgraham for the patch.
2013-09-06Fixed #11811 -- Data-loss bug in queryset.update.Aymeric Augustin
It's now forbidden to call queryset.update(field=instance) when instance hasn't been saved to the database ie. instance.pk is None.
2013-09-03Fixed "indentation is not a multiple of four" pep8 issues.Tim Graham
2013-08-22Fixed #20955 -- select_related regressionAnssi Kääriäinen
In cases where the same connection (from model A to model B along the same field) was needed multiple times in a select_related query, the join setup code mistakenly reused an existing join.
2013-08-20Fixed test failure caused by different NULL ordering between backendsAnssi Kääriäinen
2013-08-20Fixed #14056 -- Made sure LEFT JOIN aren't trimmed in ORDER BYAnssi Kääriäinen
If LEFT JOINs are required for correct results, then trimming the join can lead to incorrect results. Consider case: TBL A: ID | TBL B: ID A_ID 1 1 1 2 Now A.order_by('b__a') did use a join to B, and B's a_id column. This was seen to contain the same value as A's id, and so the join was trimmed. But this wasn't correct as the join is LEFT JOIN, and for row A.id = 2 the B.a_id column is NULL.
2013-08-19Fixed #12807 -- EmptyResultSet ORed conditionAnssi Kääriäinen
The EmptyResultSet wasn't treated correctly so the end results was incorrect, too. The bug had been already fixed in master so only tests added.
2013-08-13Fixed test failure on MySQLAnssi Kääriäinen
The fix for #20874 caused a MySQL specific failure.
2013-08-13Fixed #20874 -- bump_prefix() in nested subqueriesAnssi Kääriäinen
Also made some cleanup to build_filter() code by introducing submethods solve_lookup_type() and prepare_lookup_value().
2013-08-04Deprecated SortedDict (replaced with collections.OrderedDict)Curtis Maloney
Thanks Loic Bistuer for the review.
2013-07-29Removed most of absolute_import importsClaude Paroz
Should be unneeded with Python 2.7 and up. Added some unicode_literals along the way.
2013-07-27Fixed a number of minor misspellings.Julien Phalip
2013-07-26Fixed related model lookup regressionAnssi Kääriäinen
It has been possible to use models of wrong type in related field lookups. For example pigs__in=[a_duck] has worked. Changes to ForeignObject broke that. It might be a good idea to restrict the model types usable in lookups. This should be done intentionally, not accidentally and without any consideration for deprecation path.
2013-07-23Fixed #20788 -- exclude() generated subquery failureAnssi Kääriäinen
"Fixed" by adding a test case, the original problem was already fixed by earlier ORM changes. Thanks to david@judicata.com for the report and test case.
2013-07-14Fixed #20746 -- Removed Python 2.6 specific code/docsTim Graham
2013-07-01Stopped using django.utils.unittest in the test suite.Aymeric Augustin
Refs #20680.
2013-06-18Fixed #14930 -- values_list() failure on qs ordered by extra columnFlorian Hahn
Thanks lsaffre for the report and simon29, vicould, and Florian Hahn for the patch. Some changes done by committer.
2013-06-14Fixed #20528 -- regression in select_related join promotionAnssi Kääriäinen
The join used by select_related was incorrectly INNER when the query had an ORed filter for nullable join that was trimmed away. Fixed this by forcing the join type to LOUTER even when a join was trimmed away in ORed queries.
2013-06-01Changed assertEquals -> assertEqual.Tim Graham
2013-06-01Fixed #18785 -- Added Test join trimming regressionAnssi Kääriäinen
The regression was caused by patch to ticket #15316 and was fixed by a patch to #10790.
2013-05-29Fixed #20250 - Added a regression test for negated Q + annotateTim Graham
Thanks nott.
2013-05-27Fixed #20507 -- SubqueryConstraint alias relabelingAnssi Kääriäinen
The SubqueryConstraint defined relabeled_clone(), but that was never called. Instead there is now clone() and relabel_aliases() methods for SubqueryConstraint. A related problem was that SubqueryConstraint didn't correctly use quote_name_unless_alias() of the outer query. This resulted in failures when running under PostgreSQL.
2013-05-22Fixed #19895 -- Second iterator over invalid qs raises errorsAnssi Kääriäinen
The fix was already in the patch for #18702, so only test added for ticket #19895.
2013-05-21Fixed #18702 -- Removed chunked reads from QuerySet iterationAnssi Kääriäinen
2013-05-20Fixed qs.values() regression when used in subqueryAnssi Kääriäinen
2013-03-26Fixed #20091 -- Oracle null promotion for empty stringsAnssi Kääriäinen
2013-03-21Added tests for already fixed #20101Anssi Kääriäinen
The ticket dealt with a case where one query had .exclude() that produced a subquery, the other query had a join to the same model that was subqueried in the first query. This was already fixed in master, so only test added.
2013-03-13Refactored qs.add_q() and utils/tree.pyAnssi Kääriäinen
The sql/query.py add_q method did a lot of where/having tree hacking to get complex queries to work correctly. The logic was refactored so that it should be simpler to understand. The new logic should also produce leaner WHERE conditions. The changes cascade somewhat, as some other parts of Django (like add_filter() and WhereNode) expect boolean trees in certain format or they fail to work. So to fix the add_q() one must fix utils/tree.py, some things in add_filter(), WhereNode and so on. This commit also fixed add_filter to see negate clauses up the path. A query like .exclude(Q(reversefk__in=a_list)) didn't work similarly to .filter(~Q(reversefk__in=a_list)). The reason for this is that only the immediate parent negate clauses were seen by add_filter, and thus a tree like AND: (NOT AND: (AND: condition)) will not be handled correctly, as there is one intermediary AND node in the tree. The example tree is generated by .exclude(~Q(reversefk__in=a_list)). Still, aggregation lost connectors in OR cases, and F() objects and aggregates in same filter clause caused GROUP BY problems on some databases. Fixed #17600, fixed #13198, fixed #17025, fixed #17000, fixed #11293.
2013-03-12Fixed #19964 -- Removed relabel_aliases from some structsAnssi Kääriäinen
Before there was need to have both .relabel_aliases() and .clone() for many structs. Now there is only relabeled_clone() for those structs where alias is the only mutable attribute.
2013-03-08Fixed #15363 -- Renamed and normalized to `get_queryset` the methods that ↵Loic Bistuer
return a QuerySet.
2013-02-28Fixed #12823 -- Was already fixed in master, tests addedAnssi Kääriäinen
Also added a little improvement to sql/query.py to get rid of non-necessary IS NOT NULL check.
2013-02-26Merged regressiontests and modeltests into the test root.Florian Apolloner