From 1ec4c7c055ca045c5df6352a4cdacd9aa778e598 Mon Sep 17 00:00:00 2001 From: Teodor Sigaev Date: Fri, 8 Apr 2016 20:11:30 +0300 Subject: 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 --- src/backend/utils/adt/tsquery.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'src/backend/utils/adt/tsquery.c') 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 -- cgit v1.2.3