Fix two bugs in tsquery @> operator.

Heikki Linnakangas <heikki.linnakangas@iki.fi>

Commit: c366e1d169481a780857458f1064ae93007fd140
Author: Heikki Linnakangas <heikki.linnakangas@iki.fi>
Date: 2014-10-27T08:51:24Z
Releases: 9.4.0
Fix two bugs in tsquery @> operator.

1. The comparison for matching terms used only the CRC to decide if there's
a match. Two different terms with the same CRC gave a match.

2. It assumed that if the second operand has more terms than the first, it's
never a match. That assumption is bogus, because there can be duplicate
terms in either operand.

Rewrite the implementation in a way that doesn't have those bugs.

Backpatch to all supported versions.

Files

PathChange+/−
src/backend/utils/adt/tsquery_op.c modified +90 −41