summaryrefslogtreecommitdiff
path: root/docs/ref
diff options
context:
space:
mode:
authorTim Graham <timograham@gmail.com>2013-07-05 07:20:05 -0400
committerTim Graham <timograham@gmail.com>2013-07-05 07:21:13 -0400
commit430aae1b0db9fbcc15415b7bd9a14df1d88359cf (patch)
tree51ec0e6d2a3288818aefd9afb7224e23ae0a4812 /docs/ref
parent14a5b79e294506ab045a14fbec89030510f1cefe (diff)
[1.6.x] Fixed #20561 -- Emphasized that QuerySet.distinct([*fields]) is only supported by Postgres.
Thanks jtiai for the suggestion. Backport of 577b0f9189 from master.
Diffstat (limited to 'docs/ref')
-rw-r--r--docs/ref/models/querysets.txt13
1 files changed, 5 insertions, 8 deletions
diff --git a/docs/ref/models/querysets.txt b/docs/ref/models/querysets.txt
index 2da85600f7..2db252d006 100644
--- a/docs/ref/models/querysets.txt
+++ b/docs/ref/models/querysets.txt
@@ -379,17 +379,14 @@ query spans multiple tables, it's possible to get duplicate results when a
:meth:`values()` together, be careful when ordering by fields not in the
:meth:`values()` call.
-You can pass positional arguments (``*fields``) in order to specify the names
-of fields to which the ``DISTINCT`` should apply. This translates to a
-``SELECT DISTINCT ON`` SQL query. Here's the difference. For a normal
-``distinct()`` call, the database compares *each* field in each row when
+On PostgreSQL only, you can pass positional arguments (``*fields``) in order to
+specify the names of fields to which the ``DISTINCT`` should apply. This
+translates to a ``SELECT DISTINCT ON`` SQL query. Here's the difference. For a
+normal ``distinct()`` call, the database compares *each* field in each row when
determining which rows are distinct. For a ``distinct()`` call with specified
field names, the database will only compare the specified field names.
.. note::
- This ability to specify field names is only available in PostgreSQL.
-
-.. note::
When you specify field names, you *must* provide an ``order_by()`` in the
QuerySet, and the fields in ``order_by()`` must start with the fields in
``distinct()``, in the same order.
@@ -398,7 +395,7 @@ field names, the database will only compare the specified field names.
value in column ``a``. If you don't specify an order, you'll get some
arbitrary row.
-Examples::
+Examples (those after the first will only work on PostgreSQL)::
>>> Author.objects.distinct()
[...]