summaryrefslogtreecommitdiff
path: root/django/db/models/sql
AgeCommit message (Collapse)Author
2011-08-23[1.3.X] Fixed #14876 -- Ensure that join promotion works correctly when ↵Russell Keith-Magee
there are nullable related fields. Thanks to simonpercivall for the report, oinopion and Aleksandra Sendecka for the original patch, and to Malcolm for helping me wrestle the edge cases to the ground. Backport of r16648 from trunk. git-svn-id: http://code.djangoproject.com/svn/django/branches/releases/1.3.X@16671 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-03-14Fixed #14733: no longer "validate" .raw() queries.Jacob Kaplan-Moss
Turns out that a lot more than just SELECT can return data, and this list is very hard to define up front in a cross-database manner. So let's just assume that anyone using raw() is at least halfway competant and can deal with the error messages if they don't use a data-returning query. Thanks to Christophe Pettus for the patch. git-svn-id: http://code.djangoproject.com/svn/django/trunk@15803 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-03-03Fixed #12252 -- Ensure that queryset unions are commutative. Thanks to ↵Russell Keith-Magee
benreynwar for the report, and draft patch, and to Karen and Ramiro for the review eyeballs and patch updates. git-svn-id: http://code.djangoproject.com/svn/django/trunk@15726 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-02-08Fixed #13815 -- Ensure that reverse exclude lookups on nullable foreign keys ↵Russell Keith-Magee
exclude null values. Thanks to bpeschier for the report and patch. git-svn-id: http://code.djangoproject.com/svn/django/trunk@15458 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-01-26Fixed #15161 - Corrected handling of ManyToManyField with through table ↵Carl Meyer
using to_field on its ForeignKeys. Thanks to adehnert for the report. git-svn-id: http://code.djangoproject.com/svn/django/trunk@15330 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-01-26Tweaked r15303 to avoid O(N) lookup of field name. Thanks to Alex's eagle eyes.Carl Meyer
git-svn-id: http://code.djangoproject.com/svn/django/trunk@15324 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-01-26Fixed #13159 -- properly quote aggregates in order_by.Alex Gaynor
git-svn-id: http://code.djangoproject.com/svn/django/trunk@15318 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-01-25Fixed #11319 - Added lookup support for ForeignKey.to_field. Also reverted ↵Carl Meyer
no-longer-needed model formsets workaround for lack of such support from r10756. Thanks Russell and Alex for review. git-svn-id: http://code.djangoproject.com/svn/django/trunk@15303 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-01-14Cleaned up the ORM slightly.Alex Gaynor
git-svn-id: http://code.djangoproject.com/svn/django/trunk@15203 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-01-11Fixed #11293 -- fixed using Q objects to generate ORs with aggregates.Alex Gaynor
git-svn-id: http://code.djangoproject.com/svn/django/trunk@15173 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-12-22Fixed #10154: Allow combining F expressions with timedelta values.Karen Tracey
git-svn-id: http://code.djangoproject.com/svn/django/trunk@15018 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-12-01Fixed a bug in date queries with GIS backends introduced in [14715].Alex Gaynor
git-svn-id: http://code.djangoproject.com/svn/django/trunk@14760 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-11-26Fixed a suite of errors in the ORM -- a) fixed calling ↵Alex Gaynor
values_list().values_list() and changing whether the results are flat, b) fixed an issue with fields on the left-hand side of what becomes the HAVING clause not being included in the GROUP BY clause, and c) fixed a bug with fields from values() calls not being included in the GROUP BY clause. This fixed the recent test failures under postgresql. git-svn-id: http://code.djangoproject.com/svn/django/trunk@14715 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-11-23Fixed #14697 - speeded up model instance creation by moving work outside of ↵Luke Plant
loops Thanks to akaariai for the report and initial patch. git-svn-id: http://code.djangoproject.com/svn/django/trunk@14687 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-11-22Fixed #14754 -- corrected using an aggregate in an F expressions when that ↵Alex Gaynor
queryset is later used in a subquery. Thanks to master for the patch. git-svn-id: http://code.djangoproject.com/svn/django/trunk@14681 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-11-17Fixed #14423 -- corrected incorrect SQL being generated when a nullable, ↵Alex Gaynor
inherited field was used in an exclude. Thanks to PhiR_42 for the patch. git-svn-id: http://code.djangoproject.com/svn/django/trunk@14600 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-11-17Fixed #12687 -- fixed an issue with aggregates and counts in conjunction ↵Alex Gaynor
with annotations where the QuerySet was provably empty. git-svn-id: http://code.djangoproject.com/svn/django/trunk@14586 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-11-09Fixed #7539, #13067 -- Added on_delete argument to ForeignKey to control ↵Carl Meyer
cascade behavior. Also refactored deletion for efficiency and code clarity. Many thanks to Johannes Dollinger and Michael Glassford for extensive work on the patch, and to Alex Gaynor, Russell Keith-Magee, and Jacob Kaplan-Moss for review. git-svn-id: http://code.djangoproject.com/svn/django/trunk@14507 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-11-04Fixed a test failure introduced in [14461].Alex Gaynor
git-svn-id: http://code.djangoproject.com/svn/django/trunk@14462 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-11-04Fixed #13935, added support for using QuerySet.dates across related fields. ↵Alex Gaynor
Thanks to valyagolev for his work on the patch. git-svn-id: http://code.djangoproject.com/svn/django/trunk@14461 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-10-13Fixed #12192 -- Don't execute any DB query when the QS slicing being performedRamiro Morales
will result in use of LIMIT 0. Thanks Suor for the report. git-svn-id: http://code.djangoproject.com/svn/django/trunk@14204 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-09-16Fixed #14244: Allow lists of more than 1000 items to be used with the 'in' ↵Ian Kelly
lookup in Oracle, by breaking them up into groups of 1000 items and ORing them together. Thanks to rlynch for the report and initial patch. git-svn-id: http://code.djangoproject.com/svn/django/trunk@13859 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-09-13Fixed #11594 - Inaccurate docstring for WhereNode.add()Luke Plant
Thanks to garrison for report, dwillis for patch git-svn-id: http://code.djangoproject.com/svn/django/trunk@13843 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-07-30Fixed #13882 -- Removed an unnecessary nested where clause introduced on ↵Russell Keith-Magee
__isnull queries. Thanks to Alex Gaynor for the report and patch. git-svn-id: http://code.djangoproject.com/svn/django/trunk@13456 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-04-30Fixed #12851 -- Another attempt at fixing select_related() with inherited ↵Russell Keith-Magee
models, this time with only(). Thanks to phxx for the test case. git-svn-id: http://code.djangoproject.com/svn/django/trunk@13059 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-04-30Fixed #12851 -- Corrected the loading of values when select_related() is ↵Russell Keith-Magee
used on inherited models. Thanks to phxx for the report and test case. git-svn-id: http://code.djangoproject.com/svn/django/trunk@13054 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-04-23Fixed #11764 -- Added a missing set of parentheses in a call calculating the ↵Russell Keith-Magee
select_related tables. Thanks to aurelio for the report and original patch, and wogan for the updated patch. git-svn-id: http://code.djangoproject.com/svn/django/trunk@13019 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-04-21Fixed #13328 -- Ensured that querysets on models with callable defaults can ↵Russell Keith-Magee
be pickled. No, really this time. Thanks to Alex for his help brainstorming the solution. git-svn-id: http://code.djangoproject.com/svn/django/trunk@13013 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-04-15Fixed #13349 -- Ensure that raw queries evaluate the entire query if the ↵Russell Keith-Magee
backend doesn't support chunked reads. Thanks to Alex Gaynor for the report and patch. git-svn-id: http://code.djangoproject.com/svn/django/trunk@12978 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-04-04Fixed #12328 -- Corrected the handling of subqueries with ordering and ↵Russell Keith-Magee
slicing, especially when used in delete subqueries. Thanks to Walter Doekes for the report. This fixes a feature that isn't available under MySQL and Oracle (Refs #10099). git-svn-id: http://code.djangoproject.com/svn/django/trunk@12912 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-04-03Fixed #12247 -- Corrected the way update queries are processed when the ↵Russell Keith-Magee
update only refers to attributes on a base class. Thanks to jsmullyan for the report, and matiasb for the fix. git-svn-id: http://code.djangoproject.com/svn/django/trunk@12910 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-04-02Fixed #12429 -- Modified RawQuery to provide some facilities required by ↵Russell Keith-Magee
Oracle. Thanks to Karen Tracey for the testing help. git-svn-id: http://code.djangoproject.com/svn/django/trunk@12907 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-04-01Fixed #12429 -- Ensure that raw queries call resolve_columns if the backend ↵Russell Keith-Magee
defines it. This ensures (as much as possible) that the model values returned by a raw query match that in normal queries. Thanks to Ian Kelly for the report. git-svn-id: http://code.djangoproject.com/svn/django/trunk@12904 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-03-31Fixed #11916 -- Corrected handling of aggregation when there is a subquery ↵Russell Keith-Magee
provided in an extra(select=) clause. Thanks to jaklaassen@gmail.com for the report, and to tobias, paluh, Karen Tracey and Ian Kelly for their work on the fix. git-svn-id: http://code.djangoproject.com/svn/django/trunk@12896 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-03-21Fixed #12822: Don't copy the _aggregate_select_cache when cloning a query set,Karen Tracey
as that can lead to incorrect SQL being generated for the query. Thanks to mat for the report and test, tobias for the fix, and Alex for review. git-svn-id: http://code.djangoproject.com/svn/django/trunk@12830 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-03-20Fixed #12937 -- Corrected the operation of select_related() when following ↵Russell Keith-Magee
an reverse relation on an inherited model. Thanks to subsume for the report. git-svn-id: http://code.djangoproject.com/svn/django/trunk@12814 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-03-20Fixed #13156 -- Ensure that exists() queries are as fast as they can be. ↵Russell Keith-Magee
Thanks to Jerome Leclanche for the report. git-svn-id: http://code.djangoproject.com/svn/django/trunk@12810 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-03-15Fixed #12953 -- Ensure that deletion cascades through generic relations. ↵Russell Keith-Magee
Also cleans up the special-casing of generic relations in the deleted object discovery process. Thanks to carljm for the report and patch. git-svn-id: http://code.djangoproject.com/svn/django/trunk@12790 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-03-08Fixed #12240 - select_related doesn't work correctly when mixing nullable ↵Luke Plant
and non-nullable keys Thanks to embe for report and Alex for fix. git-svn-id: http://code.djangoproject.com/svn/django/trunk@12719 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-03-07Fixed #12876 -- Corrected a problem with recursive relations under deepcopy. ↵Russell Keith-Magee
Thanks to elachuni for the patch. git-svn-id: http://code.djangoproject.com/svn/django/trunk@12700 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-02-23Fixed #12806 -- Added an implementation of `RawQuerySet.__getitem__`. ↵Justin Bronn
Thanks, Bruno Renié. git-svn-id: http://code.djangoproject.com/svn/django/trunk@12504 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-02-23Fixed #12855 -- QuerySets with `extra` where parameters now combine ↵Justin Bronn
correctly. Thanks, Alex Gaynor. git-svn-id: http://code.djangoproject.com/svn/django/trunk@12502 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-02-10Fixed #11535: Corrected SQL generated for queries involving generic ↵Karen Tracey
relations and ORed Q objects. Thanks to brianglass for report, tobias for fix and test, and Alex for review. git-svn-id: http://code.djangoproject.com/svn/django/trunk@12405 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-01-29Fixed #12721: Ensured objects with generic relations that use non-integer ↵Karen Tracey
object ID fields can be deleted on PostgreSQL. Thanks much carljm for patch and Russ for review. git-svn-id: http://code.djangoproject.com/svn/django/trunk@12353 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-01-27Fixed #7270 -- Added the ability to follow reverse OneToOneFields in ↵Russell Keith-Magee
select_related(). Thanks to George Vilches, Ben Davis, and Alex Gaynor for their work on various stages of this patch. git-svn-id: http://code.djangoproject.com/svn/django/trunk@12307 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-12-24Fixed #12433 -- Corrected a typo in the text of the exception raised by ↵Russell Keith-Magee
RawQuery. Thanks to bjunix for the report. git-svn-id: http://code.djangoproject.com/svn/django/trunk@11973 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-12-22Changes to get raw queries working on the oracle backend.Ian Kelly
git-svn-id: http://code.djangoproject.com/svn/django/trunk@11968 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-12-22Fixed #1142 -- Added multiple database support.Russell Keith-Magee
This monster of a patch is the result of Alex Gaynor's 2009 Google Summer of Code project. Congratulations to Alex for a job well done. Big thanks also go to: * Justin Bronn for keeping GIS in line with the changes, * Karen Tracey and Jani Tiainen for their help testing Oracle support * Brett Hoerner, Jon Loyens, and Craig Kimmerer for their feedback. * Malcolm Treddinick for his guidance during the GSoC submission process. * Simon Willison for driving the original design process * Cal Henderson for complaining about ponies he wanted. ... and everyone else too numerous to mention that helped to bring this feature into fruition. git-svn-id: http://code.djangoproject.com/svn/django/trunk@11952 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-12-20Fixed #11863: added a `Model.objects.raw()` method for executing raw SQL ↵Jacob Kaplan-Moss
queries and yield models. See `docs/topics/db/raw.txt` for details. Thanks to seanoc for getting the ball rolling, and to Russ for wrapping things up. git-svn-id: http://code.djangoproject.com/svn/django/trunk@11921 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-12-17Fixed #11753 - Q objects with callables no longer explode on Python 2.4. ↵Jacob Kaplan-Moss
Thanks, Jeremy Dunck. git-svn-id: http://code.djangoproject.com/svn/django/trunk@11901 bcc190cf-cafb-0310-a4f2-bffc1f526a37