Skip to content

Commit d19d354

Browse files
committed
Revert changes of CompareTSQ: it affects existing btree indexes.
1 parent f647ed4 commit d19d354

File tree

1 file changed

+20
-7
lines changed

1 file changed

+20
-7
lines changed

src/backend/utils/adt/tsquery_op.c

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $PostgreSQL: pgsql/src/backend/utils/adt/tsquery_op.c,v 1.3.2.1 2008/03/07 15:29:27 teodor Exp $
10+
* $PostgreSQL: pgsql/src/backend/utils/adt/tsquery_op.c,v 1.3.2.2 2008/03/09 10:42:48 teodor Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -141,14 +141,27 @@ tsquery_not(PG_FUNCTION_ARGS)
141141
static int
142142
CompareTSQ(TSQuery a, TSQuery b)
143143
{
144-
QTNode *an = QT2QTN(GETQUERY(a), GETOPERAND(a));
145-
QTNode *bn = QT2QTN(GETQUERY(b), GETOPERAND(b));
146-
int res = QTNodeCompare(an, bn);
144+
if (a->size != b->size)
145+
{
146+
return (a->size < b->size) ? -1 : 1;
147+
}
148+
else if (VARSIZE(a) != VARSIZE(b))
149+
{
150+
return (VARSIZE(a) < VARSIZE(b)) ? -1 : 1;
151+
}
152+
else
153+
{
154+
QTNode *an = QT2QTN(GETQUERY(a), GETOPERAND(a));
155+
QTNode *bn = QT2QTN(GETQUERY(b), GETOPERAND(b));
156+
int res = QTNodeCompare(an, bn);
147157

148-
QTNFree(an);
149-
QTNFree(bn);
158+
QTNFree(an);
159+
QTNFree(bn);
150160

151-
return res;
161+
return res;
162+
}
163+
164+
return 0;
152165
}
153166

154167
Datum

0 commit comments

Comments
 (0)