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

Commitc5fc2fa

Browse files
committed
Support 15 version of Postgres
1 parent137afc7 commitc5fc2fa

File tree

3 files changed

+58
-9
lines changed

3 files changed

+58
-9
lines changed

‎deparse.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -405,7 +405,11 @@ vops_deparse_type_name(Oid type_oid, int32 typemod)
405405
#ifPG_VERSION_NUM>=110000
406406
uint8flags=FORMAT_TYPE_TYPEMOD_GIVEN;
407407

408+
#ifPG_VERSION_NUM>=150000
409+
if (type_oid >=FirstGenbkiObjectId)
410+
#else
408411
if (type_oid >=FirstBootstrapObjectId)
412+
#endif
409413
flags |=FORMAT_TYPE_FORCE_QUALIFY;
410414

411415
returnformat_type_extended(type_oid,typemod,flags);

‎vops.c

Lines changed: 42 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,12 @@ PG_MODULE_MAGIC;
5959
#error VOPS requires 64-bit version of Postgres
6060
#endif
6161

62+
#ifPG_VERSION_NUM>=150000
63+
#defineFUNC_CALL_CTX COERCE_EXPLICIT_CALL, -1
64+
#else
65+
#defineFUNC_CALL_CTX -1
66+
#endif
67+
6268
/* pg module functions */
6369
void_PG_init(void);
6470
void_PG_fini(void);
@@ -1151,13 +1157,24 @@ UserTableUpdateOpenIndexes()
11511157
if (HeapTupleIsHeapOnly(tuple))
11521158
return;
11531159

1160+
#ifPG_VERSION_NUM>=150000
1161+
if (estate->es_result_relations[0]->ri_NumIndices>0)
1162+
{
1163+
recheckIndexes=ExecInsertIndexTuples(estate->es_result_relations[0],
1164+
#else
11541165
if (estate->es_result_relation_info->ri_NumIndices>0)
11551166
{
1156-
recheckIndexes=ExecInsertIndexTuples(slot,
1167+
recheckIndexes=ExecInsertIndexTuples(
1168+
#endif
1169+
slot,
11571170
#ifPG_VERSION_NUM<120000
11581171
&tuple->t_self,
11591172
#endif
1160-
estate, false,NULL,NIL);
1173+
estate,
1174+
#ifPG_VERSION_NUM>=150000
1175+
true,
1176+
#endif
1177+
false,NULL,NIL);
11611178
if (recheckIndexes!=NIL)
11621179
ereport(ERROR,
11631180
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
@@ -1181,10 +1198,15 @@ static void begin_batch_insert(Oid oid)
11811198
resultRelInfo->ri_RelationDesc=rel;
11821199
resultRelInfo->ri_TrigInstrument=NULL;
11831200

1201+
#ifPG_VERSION_NUM>=150000
1202+
estate->es_result_relations= (ResultRelInfo**)palloc(sizeof(ResultRelInfo*));
1203+
estate->es_result_relations[0]=resultRelInfo;
1204+
#else
11841205
estate->es_result_relations=resultRelInfo;
11851206
estate->es_num_result_relations=1;
11861207
estate->es_result_relation_info=resultRelInfo;
1187-
ExecOpenIndices(estate->es_result_relation_info, false);
1208+
#endif
1209+
ExecOpenIndices(resultRelInfo, false);
11881210
#ifPG_VERSION_NUM>=120000
11891211
slot=ExecInitExtraTupleSlot(estate,RelationGetDescr(rel),&TTSOpsHeapTuple);
11901212
#elifPG_VERSION_NUM>=110000
@@ -1210,7 +1232,11 @@ static void insert_tuple(Datum* values, bool* nulls)
12101232

12111233
staticvoidend_batch_insert()
12121234
{
1235+
#ifPG_VERSION_NUM>=150000
1236+
ExecCloseIndices(estate->es_result_relations[0]);
1237+
#else
12131238
ExecCloseIndices(estate->es_result_relation_info);
1239+
#endif
12141240
if (ActiveSnapshotSet()) {
12151241
PopActiveSnapshot();
12161242
}
@@ -4149,7 +4175,7 @@ vops_add_index_cond(Node* clause, List* conjuncts, char const* keyName)
41494175
if (*op=='<'||*op=='>') {
41504176
A_Expr*bound=makeNode(A_Expr);
41514177
FuncCall*call=makeFuncCall(list_make1(makeString(*op=='<' ?"first" :"last")),
4152-
list_make1(expr->lexpr),-1);
4178+
list_make1(expr->lexpr),FUNC_CALL_CTX);
41534179
bound->kind=expr->kind;
41544180
bound->name=expr->name;
41554181
bound->lexpr= (Node*)call;
@@ -4159,7 +4185,7 @@ vops_add_index_cond(Node* clause, List* conjuncts, char const* keyName)
41594185
}elseif (expr->kind==AEXPR_BETWEEN) {
41604186
A_Expr*bound=makeNode(A_Expr);
41614187
FuncCall*call=makeFuncCall(list_make1(makeString("last")),
4162-
list_make1(expr->lexpr),-1);
4188+
list_make1(expr->lexpr),FUNC_CALL_CTX);
41634189
bound->kind=AEXPR_OP;
41644190
bound->name=list_make1(makeString(">="));
41654191
bound->lexpr= (Node*)call;
@@ -4169,7 +4195,7 @@ vops_add_index_cond(Node* clause, List* conjuncts, char const* keyName)
41694195

41704196
bound=makeNode(A_Expr);
41714197
call=makeFuncCall(list_make1(makeString("first")),
4172-
list_make1(expr->lexpr),-1);
4198+
list_make1(expr->lexpr),FUNC_CALL_CTX);
41734199
bound->kind=AEXPR_OP;
41744200
bound->name=list_make1(makeString("<="));
41754201
bound->lexpr= (Node*)call;
@@ -4179,7 +4205,7 @@ vops_add_index_cond(Node* clause, List* conjuncts, char const* keyName)
41794205
}elseif (*op=='=') {
41804206
A_Expr*bound=makeNode(A_Expr);
41814207
FuncCall*call=makeFuncCall(list_make1(makeString("last")),
4182-
list_make1(expr->lexpr),-1);
4208+
list_make1(expr->lexpr),FUNC_CALL_CTX);
41834209
bound->kind=expr->kind;
41844210
bound->name=list_make1(makeString(">="));
41854211
bound->lexpr= (Node*)call;
@@ -4189,7 +4215,7 @@ vops_add_index_cond(Node* clause, List* conjuncts, char const* keyName)
41894215

41904216
bound=makeNode(A_Expr);
41914217
call=makeFuncCall(list_make1(makeString("first")),
4192-
list_make1(expr->lexpr),-1);
4218+
list_make1(expr->lexpr),FUNC_CALL_CTX);
41934219
bound->kind=expr->kind;
41944220
bound->name=list_make1(makeString("<="));
41954221
bound->lexpr= (Node*)call;
@@ -4554,13 +4580,21 @@ vops_resolve_functions(void)
45544580
}
45554581
}
45564582

4583+
#ifPG_VERSION_NUM>=150000
4584+
staticvoidvops_post_parse_analysis_hook(ParseState*pstate,Query*query,JumbleState*jstate)
4585+
#else
45574586
staticvoidvops_post_parse_analysis_hook(ParseState*pstate,Query*query)
4587+
#endif
45584588
{
45594589
vops_varvar;
45604590
/* Invoke original hook if needed */
45614591
if (post_parse_analyze_hook_next)
45624592
{
4593+
#ifPG_VERSION_NUM>=150000
4594+
post_parse_analyze_hook_next(pstate,query,jstate);
4595+
#else
45634596
post_parse_analyze_hook_next(pstate,query);
4597+
#endif
45644598
}
45654599
vops_resolve_functions();
45664600

‎vops_fdw.c

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,9 @@
3535
#include"optimizer/paths.h"
3636
#include"optimizer/planmain.h"
3737
#include"optimizer/plancat.h"
38+
#ifPG_VERSION_NUM>=150000
39+
#include"optimizer/prep.h"
40+
#endif
3841
#include"optimizer/restrictinfo.h"
3942
#ifPG_VERSION_NUM>=120000
4043
#include"access/table.h"
@@ -997,18 +1000,26 @@ estimate_path_cost_size(PlannerInfo *root,
9971000
MemSet(&aggcosts,0,sizeof(AggClauseCosts));
9981001
if (root->parse->hasAggs)
9991002
{
1003+
#ifPG_VERSION_NUM>=150000
1004+
get_agg_clause_costs(root,AGGSPLIT_SIMPLE,&aggcosts);
1005+
#else
10001006
get_agg_clause_costs(root, (Node*)fpinfo->grouped_tlist,
10011007
AGGSPLIT_SIMPLE,&aggcosts);
10021008
get_agg_clause_costs(root, (Node*)root->parse->havingQual,
10031009
AGGSPLIT_SIMPLE,&aggcosts);
1010+
#endif
10041011
}
10051012

10061013
/* Get number of grouping columns and possible number of groups */
10071014
numGroupCols=list_length(root->parse->groupClause);
10081015
numGroups=estimate_num_groups(root,
10091016
get_sortgrouplist_exprs(root->parse->groupClause,
10101017
fpinfo->grouped_tlist),
1011-
input_rows,NULL);
1018+
input_rows,
1019+
#ifPG_VERSION_NUM>=150000
1020+
NULL,
1021+
#endif
1022+
NULL);
10121023

10131024
/*
10141025
* Number of rows expected from foreign server will be same as

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp