Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit20587cf

Browse files
committed
Merge branch 'master' into public_master
2 parents39cb506 +241b198 commit20587cf

File tree

4 files changed

+67
-10
lines changed

4 files changed

+67
-10
lines changed

‎src/rum_ts_utils.c

Lines changed: 45 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,15 +34,33 @@
3434
#defineTS_EXEC_PHRASE_NO_POS TS_EXEC_PHRASE_AS_AND
3535
#endif
3636

37+
#ifPG_VERSION_NUM >=130000
38+
/* Since v13 TS_execute flag naming and defaults have reverted:
39+
* - before v13 - - since v13 -
40+
* TS_EXEC_CALC_NOT (0x01) TS_EXEC_SKIP_NOT (0x01)
41+
*/
42+
#defineTS_EXEC_CALC_NOT (0x01)/* Defined here for use with rum_TS_execute for
43+
*compatibility with version < 13 where this
44+
*flag was defined globally.
45+
*XXX Since v13 current global flag
46+
*TS_EXEC_SKIP_NOT has reverted meaning for
47+
*TS_execute but TS_EXEC_CALC_NOT should still
48+
*be passed to rum_TS_execute in unchanged (previous)
49+
*meaning but should not be passed into TS_execute:
50+
*(TS_execute will do 'calc not' by default, and
51+
*if you need skip it, use new TS_EXEC_SKIP_NOT)
52+
*/
53+
typedefTSTernaryValueRumTernaryValue;
54+
#else
3755
typedefenum
3856
{
3957
TS_NO,/* definitely no match */
4058
TS_YES,/* definitely does match */
4159
TS_MAYBE/* can't verify match for lack of pos data */
4260
}RumTernaryValue;
61+
#endif
4362
typedefRumTernaryValue (*RumExecuteCallbackTernary) (void*arg,QueryOperand*val,ExecPhraseData*data);
4463

45-
4664
PG_FUNCTION_INFO_V1(rum_extract_tsvector);
4765
PG_FUNCTION_INFO_V1(rum_extract_tsvector_hash);
4866
PG_FUNCTION_INFO_V1(rum_extract_tsquery);
@@ -180,7 +198,11 @@ static WordEntryPosVector POSNULL = {
180198
#defineQR_GET_OPERAND(q,v)\
181199
(&((q)->operandData[ ((QueryItem*)(v)) - GETQUERY((q)->query) ]))
182200

201+
#ifPG_VERSION_NUM >=130000
202+
staticTSTernaryValue
203+
#else
183204
staticbool
205+
#endif
184206
pre_checkcondition_rum(void*checkval,QueryOperand*val,ExecPhraseData*data)
185207
{
186208
RumChkVal*gcv= (RumChkVal*)checkval;
@@ -192,9 +214,12 @@ pre_checkcondition_rum(void *checkval, QueryOperand *val, ExecPhraseData *data)
192214

193215
/* convert item's number to corresponding entry's (operand's) number */
194216
j=gcv->map_item_operand[((QueryItem*)val)-gcv->first_item];
195-
196217
/* return presence of current entry in indexed value */
218+
#ifPG_VERSION_NUM >=130000
219+
return (*(gcv->need_recheck) ?TS_MAYBE : (gcv->check[j] ?TS_YES :TS_NO) );
220+
#else
197221
returngcv->check[j];
222+
#endif
198223
}
199224

200225
Datum
@@ -203,7 +228,7 @@ rum_tsquery_pre_consistent(PG_FUNCTION_ARGS)
203228
bool*check= (bool*)PG_GETARG_POINTER(0);
204229
TSQueryquery=PG_GETARG_TSQUERY(2);
205230
Pointer*extra_data= (Pointer*)PG_GETARG_POINTER(4);
206-
boolrecheck;
231+
boolrecheck= false;
207232
boolres= false;
208233

209234
if (query->size>0)
@@ -219,10 +244,17 @@ rum_tsquery_pre_consistent(PG_FUNCTION_ARGS)
219244
gcv.map_item_operand= (int*) (extra_data[0]);
220245
gcv.need_recheck=&recheck;
221246

247+
#ifPG_VERSION_NUM >=130000
248+
res=TS_execute(GETQUERY(query),
249+
&gcv,
250+
TS_EXEC_PHRASE_NO_POS |TS_EXEC_SKIP_NOT,
251+
pre_checkcondition_rum);
252+
#else
222253
res=TS_execute(GETQUERY(query),
223254
&gcv,
224255
TS_EXEC_PHRASE_NO_POS,
225256
pre_checkcondition_rum);
257+
#endif
226258
}
227259

228260
PG_RETURN_BOOL(res);
@@ -1466,9 +1498,13 @@ Cover(DocRepresentation *doc, uint32 len, QueryRepresentation *qr,
14661498
}
14671499
}
14681500

1469-
1501+
#ifPG_VERSION_NUM >=130000
1502+
if (TS_execute(GETQUERY(qr->query), (void*)qr,TS_EXEC_SKIP_NOT,
1503+
(TSExecuteCallback)checkcondition_QueryOperand))
1504+
#else
14701505
if (TS_execute(GETQUERY(qr->query), (void*)qr,TS_EXEC_EMPTY,
14711506
checkcondition_QueryOperand))
1507+
#endif
14721508
{
14731509
if (ptr->pos>ext->q)
14741510
{
@@ -1508,8 +1544,13 @@ Cover(DocRepresentation *doc, uint32 len, QueryRepresentation *qr,
15081544
WEP_SETWEIGHT(qro->pos,ptr->wclass);
15091545
}
15101546
}
1547+
#ifPG_VERSION_NUM >=130000
1548+
if (TS_execute(GETQUERY(qr->query), (void*)qr,TS_EXEC_EMPTY,
1549+
(TSExecuteCallback)checkcondition_QueryOperand))
1550+
#else
15111551
if (TS_execute(GETQUERY(qr->query), (void*)qr,TS_EXEC_CALC_NOT,
15121552
checkcondition_QueryOperand))
1553+
#endif
15131554
{
15141555
if (ptr->pos<ext->p)
15151556
{

‎src/rumscan.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -703,9 +703,12 @@ rumNewScanKey(IndexScanDesc scan)
703703
repalloc(so->entries,so->allocentries*sizeof(RumScanEntry));
704704
}
705705

706-
memcpy(so->entries+so->totalentries,
707-
key->scanEntry,sizeof(*key->scanEntry)*key->nentries);
708-
so->totalentries+=key->nentries;
706+
if (key->scanEntry!=NULL )
707+
{
708+
memcpy(so->entries+so->totalentries,
709+
key->scanEntry,sizeof(*key->scanEntry)*key->nentries);
710+
so->totalentries+=key->nentries;
711+
}
709712
}
710713

711714
/*

‎src/rumsort.c

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121

2222
#include"commands/tablespace.h"
2323
#include"executor/executor.h"
24-
#include"utils/guc.h"
2524
#include"utils/logtape.h"
2625
#include"utils/pg_rusage.h"
2726

@@ -40,17 +39,30 @@
4039
#endif
4140

4241
#ifPG_VERSION_NUM >=110000
42+
#ifPG_VERSION_NUM >=130000
43+
#defineLogicalTapeSetCreate(X) LogicalTapeSetCreate(X, false, NULL, NULL, 1)
44+
#else
4345
#defineLogicalTapeSetCreate(X) LogicalTapeSetCreate(X, NULL, NULL, 1)
46+
#endif
4447
#defineLogicalTapeFreeze(X,Y) LogicalTapeFreeze(X, Y, NULL)
4548
#endif
4649

4750
/*
4851
* Below are copied definitions from src/backend/utils/sort/tuplesort.c.
4952
*/
5053

51-
/* GUC variables */
54+
/* For PGPRO since v.13 trace_sort is imported from backend by including its
55+
* declaration in guc.h (guc.h contains added Windows export/import magic to be done
56+
* during postgres.exe compilation).
57+
* For older or non-PGPRO versions on Windows platform trace_sort is not exported by
58+
* backend so it is declared local for this case.
59+
*/
5260
#ifdefTRACE_SORT
53-
booltrace_sort= false;
61+
#if ( !defined (_MSC_VER)|| (PG_VERSION_NUM >=130000&& defined (PGPRO_VERSION)) )
62+
#include"utils/guc.h"
63+
#else
64+
booltrace_sort= false;
65+
#endif
5466
#endif
5567

5668
typedefstruct

‎src/rumtsquery.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@ make_query_item_wrap(QueryItem *item, QueryItemWrap *parent, bool not)
108108
}
109109
caseOP_PHRASE:
110110
elog(ERROR,"Indexing of phrase tsqueries isn't supported yet");
111+
break;
111112
default:
112113
elog(ERROR,"Invalid tsquery operator");
113114
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp