aboutsummaryrefslogtreecommitdiff
path: root/src/backend/utils/adt/tsquery.c
diff options
context:
space:
mode:
authorTeodor Sigaev <teodor@sigaev.ru>2016-04-08 20:11:30 +0300
committerTeodor Sigaev <teodor@sigaev.ru>2016-04-08 20:11:30 +0300
commit1ec4c7c055ca045c5df6352a4cdacd9aa778e598 (patch)
tree7bb889947d9cf11740ef3c0ebb130a421bc0ea25 /src/backend/utils/adt/tsquery.c
parent76a1c97bf21c301f61bb41345e0cdd0d365b2086 (diff)
downloadpostgresql-1ec4c7c055ca045c5df6352a4cdacd9aa778e598.tar.gz
postgresql-1ec4c7c055ca045c5df6352a4cdacd9aa778e598.zip
Restore original tsquery operation numbering.
As noticed by Tom Lane changing operation's number in commit bb140506df605fab58f48926ee1db1f80bdafb59 causes on-disk format incompatibility. Revert to previous numbering, that is reason to add special array to store priorities of operation. Also it reverts order of tsquery to previous. Author: Dmitry Ivanov
Diffstat (limited to 'src/backend/utils/adt/tsquery.c')
-rw-r--r--src/backend/utils/adt/tsquery.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/backend/utils/adt/tsquery.c b/src/backend/utils/adt/tsquery.c
index 257b5d33456..eea6e0eae17 100644
--- a/src/backend/utils/adt/tsquery.c
+++ b/src/backend/utils/adt/tsquery.c
@@ -16,12 +16,21 @@
#include "libpq/pqformat.h"
#include "miscadmin.h"
+#include "tsearch/ts_type.h"
#include "tsearch/ts_locale.h"
#include "tsearch/ts_utils.h"
#include "utils/builtins.h"
#include "utils/memutils.h"
#include "utils/pg_crc.h"
+/* FTS operator priorities, see ts_type.h */
+const int tsearch_op_priority[OP_COUNT] =
+{
+ 3, /* OP_NOT */
+ 2, /* OP_AND */
+ 1, /* OP_OR */
+ 4 /* OP_PHRASE */
+};
struct TSQueryParserStateData
{
@@ -736,9 +745,6 @@ while( ( (inf)->cur - (inf)->buf ) + (addsize) + 1 >= (inf)->buflen ) \
(inf)->cur = (inf)->buf + len; \
}
-#define PRINT_PRIORITY(x) \
- ( (QO_PRIORITY(x) == OP_NOT) ? OP_NOT_PHRASE : QO_PRIORITY(x) )
-
/*
* recursively traverse the tree and
* print it in infix (human-readable) form