diff options
| author | Hang Park <hangpark@kaist.ac.kr> | 2019-03-10 05:32:20 +0900 |
|---|---|---|
| committer | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2019-03-09 21:32:20 +0100 |
| commit | 142e1ead76fd452dc9bca0ab0f12bad56a116fb5 (patch) | |
| tree | 7775c9e727422a5698fe0a0f4efe5b0f289f62d1 | |
| parent | a35bf4af72779e9230b3db2db701665ae467d7dc (diff) | |
Fixed #30242 -- Removed extra space before LIMIT/OFFSET SQL.
| -rw-r--r-- | AUTHORS | 1 | ||||
| -rw-r--r-- | django/db/backends/base/operations.py | 8 | ||||
| -rw-r--r-- | django/db/backends/oracle/operations.py | 8 |
3 files changed, 9 insertions, 8 deletions
@@ -325,6 +325,7 @@ answer newbie questions, and generally made Django that much better: Guillaume Pannatier <guillaume.pannatier@gmail.com> Gustavo Picon hambaloney + Hang Park <hangpark@kaist.ac.kr> Hannes Struß <x@hannesstruss.de> Hasan Ramezani <hasan.r67@gmail.com> Hawkeye diff --git a/django/db/backends/base/operations.py b/django/db/backends/base/operations.py index b4c2250dfa..892527873a 100644 --- a/django/db/backends/base/operations.py +++ b/django/db/backends/base/operations.py @@ -218,10 +218,10 @@ class BaseDatabaseOperations: def limit_offset_sql(self, low_mark, high_mark): """Return LIMIT/OFFSET SQL clause.""" limit, offset = self._get_limit_offset_params(low_mark, high_mark) - return '%s%s' % ( - (' LIMIT %d' % limit) if limit else '', - (' OFFSET %d' % offset) if offset else '', - ) + return ' '.join(sql for sql in ( + ('LIMIT %d' % limit) if limit else None, + ('OFFSET %d' % offset) if offset else None, + ) if sql) def last_executed_query(self, cursor, sql, params): """ diff --git a/django/db/backends/oracle/operations.py b/django/db/backends/oracle/operations.py index 84c6bcc75f..6ac6b29737 100644 --- a/django/db/backends/oracle/operations.py +++ b/django/db/backends/oracle/operations.py @@ -249,10 +249,10 @@ END; def limit_offset_sql(self, low_mark, high_mark): fetch, offset = self._get_limit_offset_params(low_mark, high_mark) - return '%s%s' % ( - (' OFFSET %d ROWS' % offset) if offset else '', - (' FETCH FIRST %d ROWS ONLY' % fetch) if fetch else '', - ) + return ' '.join(sql for sql in ( + ('OFFSET %d ROWS' % offset) if offset else None, + ('FETCH FIRST %d ROWS ONLY' % fetch) if fetch else None, + ) if sql) def last_executed_query(self, cursor, sql, params): # https://cx-oracle.readthedocs.io/en/latest/cursor.html#Cursor.statement |
