|
78 | 78 | * Portions Copyright (c) 1994, Regents of the University of California
|
79 | 79 | *
|
80 | 80 | * IDENTIFICATION
|
81 |
| - * $Header: /cvsroot/pgsql/src/backend/utils/sort/tuplesort.c,v 1.20 2001/10/28 06:25:57 momjian Exp $ |
| 81 | + * $Header: /cvsroot/pgsql/src/backend/utils/sort/tuplesort.c,v 1.21 2001/11/11 22:00:25 tgl Exp $ |
82 | 82 | *
|
83 | 83 | *-------------------------------------------------------------------------
|
84 | 84 | */
|
@@ -1881,8 +1881,13 @@ comparetup_index(Tuplesortstate *state, const void *a, const void *b)
|
1881 | 1881 | * equal they *must* get compared at some stage of the sort ---
|
1882 | 1882 | * otherwise the sort algorithm wouldn't have checked whether one must
|
1883 | 1883 | * appear before the other.
|
| 1884 | + * |
| 1885 | + * Some rather brain-dead implementations of qsort will sometimes |
| 1886 | + * call the comparison routine to compare a value to itself. (At this |
| 1887 | + * writing only QNX 4 is known to do such silly things.) Don't raise |
| 1888 | + * a bogus error in that case. |
1884 | 1889 | */
|
1885 |
| -if (state->enforceUnique&& !equal_hasnull) |
| 1890 | +if (state->enforceUnique&& !equal_hasnull&&tuple1!=tuple2) |
1886 | 1891 | elog(ERROR,"Cannot create unique index. Table contains non-unique values");
|
1887 | 1892 |
|
1888 | 1893 | return0;
|
|