diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2001-11-11 22:00:25 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2001-11-11 22:00:25 +0000 |
commit | 69a59150c20be17632ca7adbed91fcc0cc44612e (patch) | |
tree | b067db429856155da71d82f435758a297ed7edac /src | |
parent | c5c97318f974e983f06b7a3636bcdd6d1bdb73b3 (diff) | |
download | postgresql-69a59150c20be17632ca7adbed91fcc0cc44612e.tar.gz postgresql-69a59150c20be17632ca7adbed91fcc0cc44612e.zip |
Defend against brain-dead QNX implementation of qsort().
Per report from Bernd Tegge, 10-Nov-01.
Diffstat (limited to 'src')
-rw-r--r-- | src/backend/utils/sort/tuplesort.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/backend/utils/sort/tuplesort.c b/src/backend/utils/sort/tuplesort.c index 796be9d6c7f..ad937c95aa3 100644 --- a/src/backend/utils/sort/tuplesort.c +++ b/src/backend/utils/sort/tuplesort.c @@ -78,7 +78,7 @@ * Portions Copyright (c) 1994, Regents of the University of California * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/utils/sort/tuplesort.c,v 1.20 2001/10/28 06:25:57 momjian Exp $ + * $Header: /cvsroot/pgsql/src/backend/utils/sort/tuplesort.c,v 1.21 2001/11/11 22:00:25 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -1881,8 +1881,13 @@ comparetup_index(Tuplesortstate *state, const void *a, const void *b) * equal they *must* get compared at some stage of the sort --- * otherwise the sort algorithm wouldn't have checked whether one must * appear before the other. + * + * Some rather brain-dead implementations of qsort will sometimes + * call the comparison routine to compare a value to itself. (At this + * writing only QNX 4 is known to do such silly things.) Don't raise + * a bogus error in that case. */ - if (state->enforceUnique && !equal_hasnull) + if (state->enforceUnique && !equal_hasnull && tuple1 != tuple2) elog(ERROR, "Cannot create unique index. Table contains non-unique values"); return 0; |