Commit Graph

582 Commits

Author SHA1 Message Date
Mariusz Felisiak 0899d583bd Fixed #28670 -- Added FETCH/OFFSET support on Oracle.
Thanks Tim Graham for the review.
2017-10-09 18:07:03 +02:00
Mariusz Felisiak 11ade8eefd Refs #24254 -- Removed unnecessary SQL AS clause in SQLCompiler.as_sql().
Incorrect on Oracle.
2017-10-06 12:47:41 -04:00
Mariusz Felisiak 03da070f5c Refs #28670 -- Moved LIMIT/OFFSET SQL to DatabaseOperations.limit_offset_sql().
Thanks Tim Graham for the review.
2017-10-04 20:24:38 +02:00
Tim Graham 51d230e00b Fixed #28675 -- Removed always True variable in SQLInsertCompiler.execute_sql() check.
Unused since 7deb25b8dd.
2017-10-03 10:32:11 -04:00
Дилян Палаузов 5d9b736fd8 Fixed #28652 -- Fixed a few comments in django/db/models/*. 2017-10-02 11:15:26 -04:00
Nicolas Delaby 01d440fa1e Fixed #27332 -- Added FilteredRelation API for conditional join (ON clause) support.
Thanks Anssi Kääriäinen for contributing to the patch.
2017-09-22 11:53:17 -04:00
Nicolas Delaby a30ef353e2 Removed unused list in Query.resolve_lookup_value().
Unneeded since its introduction in 4f138fe5a4.
2017-09-20 09:50:14 -04:00
Mads Jensen d549b88050 Fixed #26608 -- Added support for window expressions (OVER clause).
Thanks Josh Smeaton, Mariusz Felisiak, Sergey Fedoseev, Simon Charettes,
Adam Chainz/Johnson and Tim Graham for comments and reviews and Jamie
Cockburn for initial patch.
2017-09-18 09:42:29 -04:00
Tim Graham cb362a6750 Removed unnecessary check in SQLCompiler.get_related_selections(). 2017-09-15 08:37:46 -04:00
Tim Graham 6e4c6281db Reverted "Fixed #27818 -- Replaced try/except/pass with contextlib.suppress()."
This reverts commit 550cb3a365
because try/except performs better.
2017-09-07 08:16:21 -04:00
Sergey Fedoseev 8b2515a450 Removed unneeded __init__() methods. 2017-09-07 08:10:49 -04:00
Mariusz Felisiak fe0184b412 Updated EmpytResultSet import not to use the alias. 2017-09-03 11:06:06 -04:00
Mariusz Felisiak 2470756de0 Moved select_sql in SQLCompiler.get_extra_select() to improve performance. 2017-09-02 16:39:51 -04:00
Jeremy Kerr 84b7cb7df0 Fixed #28549 -- Fixed QuerySet.defer() with super and subclass fields.
Previously, deferring fields in different classes didn't omit the
superclass' deferred field.

Thanks Simon Charette for the suggested fix.
2017-08-31 09:35:05 -04:00
Sergey Fedoseev dca67bb2c2 Refs #28459 -- Improved performance of SQLCompiler.apply_converters(). 2017-08-23 16:26:24 -04:00
Sergey Fedoseev 41640760df Simplified generation of result in Query.get_aggregation(). 2017-08-15 09:59:31 -04:00
Sergey Fedoseev 6141040813 Avoided creation of temporary set in Query.append_annotation_mask(). 2017-08-15 09:43:47 -04:00
Sergey Fedoseev 0ec134e340 Simplified calculation of used joins in Query.build_filter(). 2017-08-11 10:46:11 -04:00
Sergey Fedoseev 7fa92daa99 Removed outdated comment in Query.build_filter(). 2017-08-11 09:19:19 -04:00
Sergey Fedoseev b8731c3fff Refs #28459 -- Improved performance of sql.compiler.cursor_iter(). 2017-08-08 14:07:03 -04:00
Sergey Fedoseev ca46f4688c Refs #28459 -- Improved performance of SQLCompiler.results_iter(). 2017-08-07 17:06:15 -04:00
Matthew Wilkes 32d1bf2bdb Fixed #28454 -- Simplifed use of Query.setup_joins() by returning a named tuple. 2017-08-01 14:25:54 -04:00
Sergey Fedoseev 62dee1483d Refs #28370 -- Moved db converters deprecation warning to improve performance. 2017-08-01 08:05:32 -04:00
Sergey Fedoseev 58da81a5a3 Fixed #27985 -- Fixed query for __exact=value when get_prep_value() converts value to None.
Also fixed crash of .filter(field__transform=None).
2017-07-31 15:34:07 -04:00
Anssi Kääriäinen 6155bc4a51 Refs #20880 -- Removed non-cloning logic from Query.clone(). 2017-07-31 15:31:29 -04:00
Sergey Fedoseev 0baea920c8 Fixed #28453 -- Made __exact=None lookup use transforms. 2017-07-31 13:31:04 -04:00
Sergey Fedoseev aadd3aeb2b Avoided creating temporary lists for obtaining the first item. 2017-07-31 11:02:23 -04:00
Sergey Fedoseev 38988f289f Avoided creation of temporary sets. 2017-07-29 10:16:43 -04:00
Tim Graham 487362fa8f Fixed #28370 -- Deprecated the context arg of Field.from_db_value() and Expression.convert_value().
Unused since a0d166306f.
2017-07-20 16:30:08 -04:00
Florian Apolloner adab280cef Fixed #28399 -- Fixed QuerySet.count() for union(), difference(), and intersection() queries. 2017-07-15 08:20:12 -04:00
Mariusz Felisiak ca74e56350 Fixed #28378 -- Fixed union() and difference() when combining with a queryset raising EmptyResultSet.
Thanks Jon Dufresne for the report. Thanks Tim Graham and Simon Charette
for the reviews.
2017-07-10 20:40:08 +02:00
Tim Graham 31a2af1c01 Removed useless hasattr in UpdateQuery._setup_query().
The if statement always evaluates to True.
2017-07-08 08:12:46 -04:00
Tim Graham 23c529a774 Removed unused Query.clone() memo kwarg.
Unused since 23ca3a0194.
2017-07-07 09:29:58 -04:00
Ran Benita b9f7dce84b Fixed #28010 -- Added FOR UPDATE OF support to QuerySet.select_for_update(). 2017-06-29 16:00:15 -04:00
Anssi Kääriäinen f7f5edd50d Removed obsolete Query.tables attribute.
Obsolete since Query.alias_map became an OrderedDict (refs #26522).
2017-06-29 11:09:11 -04:00
Tim Graham 7acbe89cc2 Refs #23853 -- Updated sql.query.Query.join() docstring.
Follow up to ab89414f40.
2017-06-13 14:16:52 -04:00
Mariusz Felisiak 82175ead72 Fixed #28293 -- Fixed union(), intersection(), and difference() when combining with an EmptyQuerySet.
Thanks Jon Dufresne for the report and Tim Graham for the review.
2017-06-13 08:16:16 +02:00
Claude Paroz af69f14e7b Removed unused sql.Query.query_terms
Unused since 5008a4db44.
2017-06-08 13:11:51 -04:00
Jon Dufresne 2c69824e5a Refs #23968 -- Removed unnecessary lists, generators, and tuple calls. 2017-06-01 19:08:59 -04:00
François Freitag edee5a8de6 Fixed #27639 -- Added chunk_size parameter to QuerySet.iterator(). 2017-06-01 17:50:41 -04:00
Jon Dufresne 21046e7773 Fixed #28249 -- Removed unnecessary dict.keys() calls.
iter(dict) is equivalent to iter(dict.keys()).
2017-05-27 19:08:46 -04:00
Simon Charette 4acae21846 Fixed #24254 -- Fixed queries using the __in lookup with querysets using distinct() and order_by().
Thanks Tim for the review.
2017-05-11 21:50:07 -04:00
Simon Charette daf2bd3efe Fixed #28107 -- Disabled grouping of selected primary keys for unmanaged models.
The grouping caused an issue with database views as PostgreSQL's query planer
isn't smart enough to introspect primary keys through views. Django doesn't
support database views but documents that unmanaged models should be used to
query them.

Thanks powderflask for the detailed report and investigation.
2017-05-11 20:00:57 -04:00
Simon Charette 9ae4362bec Refs #16187 -- Stopped compiling query compilers during lookup rhs processing.
Lookup right hand side processing was compiling query compilers which happened
to work by chance as SQLCompiler defines a as_sql() method with two optional
parameters albeit it doesn't expect the same type of arguments.
2017-05-01 00:41:21 -04:00
Simon Charette eb4724a063 Reverted "Refs #20939 -- Moved subquery ordering clearing optimization to the __in lookup."
This reverts commit e62ea0bb9c since it
broke multi-column __in lookups and _meta.order_wrt on Oracle.
2017-04-28 09:30:35 -04:00
Simon Charette e62ea0bb9c Refs #20939 -- Moved subquery ordering clearing optimization to the __in lookup.
Queries could potentially be resolved in cases where ordering matter.
2017-04-27 16:58:08 -04:00
Jon Dufresne 7be94e0335 Replaced set |= operator with update() to avoid temporary set. 2017-04-27 08:16:19 -04:00
Simon Charette c9159a082e Refs #20939 -- Removed the Query._prepare_as_filter_value() hack. 2017-04-25 23:43:33 -04:00
Simon Charette ec50937bcb Refs #20939 -- Removed the Query._forced_pk hack. 2017-04-25 23:43:33 -04:00
Simon Charette 8ef35468b6 Fixed #28101 -- Fixed a regression with nested __in subquery lookups and to_field.
Thanks Kristian Klette for the report and Tim for the help.
2017-04-23 00:21:27 -04:00