Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Fixed #20561 -- Emphasized that QuerySet.distinct([*fields]) is only …

…supported by Postgres.

Thanks jtiai for the suggestion.
  • Loading branch information...
commit 577b0f91894469872974ad609b4fabca949cdc1b 1 parent b9fcead
Tim Graham authored

Showing 1 changed file with 5 additions and 8 deletions. Show diff stats Hide diff stats

  1. 13  docs/ref/models/querysets.txt
13  docs/ref/models/querysets.txt
@@ -379,17 +379,14 @@ query spans multiple tables, it's possible to get duplicate results when a
379 379
     :meth:`values()` together, be careful when ordering by fields not in the
380 380
     :meth:`values()` call.
381 381
 
382  
-You can pass positional arguments (``*fields``) in order to specify the names
383  
-of fields to which the ``DISTINCT`` should apply. This translates to a
384  
-``SELECT DISTINCT ON`` SQL query. Here's the difference. For a normal
385  
-``distinct()`` call, the database compares *each* field in each row when
  382
+On PostgreSQL only, you can pass positional arguments (``*fields``) in order to
  383
+specify the names of fields to which the ``DISTINCT`` should apply. This
  384
+translates to a ``SELECT DISTINCT ON`` SQL query. Here's the difference. For a
  385
+normal ``distinct()`` call, the database compares *each* field in each row when
386 386
 determining which rows are distinct. For a ``distinct()`` call with specified
387 387
 field names, the database will only compare the specified field names.
388 388
 
389 389
 .. note::
390  
-    This ability to specify field names is only available in PostgreSQL.
391  
-
392  
-.. note::
393 390
     When you specify field names, you *must* provide an ``order_by()`` in the
394 391
     QuerySet, and the fields in ``order_by()`` must start with the fields in
395 392
     ``distinct()``, in the same order.
@@ -398,7 +395,7 @@ field names, the database will only compare the specified field names.
398 395
     value in column ``a``. If you don't specify an order, you'll get some
399 396
     arbitrary row.
400 397
 
401  
-Examples::
  398
+Examples (those after the first will only work on PostgreSQL)::
402 399
 
403 400
     >>> Author.objects.distinct()
404 401
     [...]

0 notes on commit 577b0f9

Please sign in to comment.
Something went wrong with that request. Please try again.