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

Commita084041

Browse files
author
Maksim Milyutin
committed
Add compat version of create_merge_append_path routine and other light fixes
1 parent2bbdd2d commita084041

File tree

5 files changed

+67
-54
lines changed

5 files changed

+67
-54
lines changed

‎src/compat/pg_compat.c

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -352,6 +352,28 @@ McxtStatsInternal(MemoryContext context, int level,
352352
#endif
353353

354354

355+
/*
356+
* oid_cmp
357+
*
358+
* qsort comparison function for Oids;
359+
* needed for find_inheritance_children_array() function
360+
*/
361+
#ifPG_VERSION_NUM >=90500&&PG_VERSION_NUM<100000
362+
int
363+
oid_cmp(constvoid*p1,constvoid*p2)
364+
{
365+
Oidv1=*((constOid*)p1);
366+
Oidv2=*((constOid*)p2);
367+
368+
if (v1<v2)
369+
return-1;
370+
if (v1>v2)
371+
return1;
372+
return0;
373+
}
374+
#endif
375+
376+
355377
/*
356378
* set_dummy_rel_pathlist
357379
* Build a dummy path for a relation that's been excluded by constraints

‎src/include/compat/pg_compat.h

Lines changed: 39 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ void CatalogIndexInsert(CatalogIndexState indstate, HeapTuple heapTuple);
169169
*/
170170
#ifPG_VERSION_NUM >=100000
171171
#definecreate_append_path_compat(rel,subpaths,required_outer,parallel_workers) \
172-
create_append_path((rel), (subpaths), (required_outer), (parallel_workers),NULL)
172+
create_append_path((rel), (subpaths), (required_outer), (parallel_workers),NIL)
173173
#elifPG_VERSION_NUM >=90600
174174

175175
#ifndefPGPRO_VERSION
@@ -187,6 +187,22 @@ void CatalogIndexInsert(CatalogIndexState indstate, HeapTuple heapTuple);
187187
#endif/* PG_VERSION_NUM */
188188

189189

190+
/*
191+
* create_merge_append_path()
192+
*/
193+
#ifPG_VERSION_NUM >=100000
194+
#definecreate_merge_append_path_compat(root,rel,subpaths,pathkeys, \
195+
required_outer) \
196+
create_merge_append_path((root), (rel), (subpaths), (pathkeys), \
197+
(required_outer), NIL)
198+
#elifPG_VERSION_NUM >=90500
199+
#definecreate_merge_append_path_compat(root,rel,subpaths,pathkeys, \
200+
required_outer) \
201+
create_merge_append_path((root), (rel), (subpaths), (pathkeys), \
202+
(required_outer))
203+
#endif
204+
205+
190206
/*
191207
* create_nestloop_path()
192208
*/
@@ -418,6 +434,14 @@ void McxtStatsInternal(MemoryContext context, int level,
418434
#endif
419435

420436

437+
/*
438+
* oid_cmp()
439+
*/
440+
#ifPG_VERSION_NUM >=90500&&PG_VERSION_NUM<100000
441+
externintoid_cmp(constvoid*p1,constvoid*p2);
442+
#endif
443+
444+
421445
/*
422446
* parse_analyze()
423447
*
@@ -512,6 +536,20 @@ extern void set_rel_consider_parallel(PlannerInfo *root,
512536
#endif
513537

514538

539+
/*
540+
* tlist_member_ignore_relabel()
541+
*
542+
* in compat version the type of first argument is (Expr *)
543+
*/
544+
#ifPG_VERSION_NUM >=100000
545+
#definetlist_member_ignore_relabel_compat(expr,targetlist) \
546+
tlist_member_ignore_relabel((expr), (targetlist))
547+
#elifPG_VERSION_NUM >=90500
548+
#definetlist_member_ignore_relabel_compat(expr,targetlist) \
549+
tlist_member_ignore_relabel((Node *) (expr), (targetlist))
550+
#endif
551+
552+
515553
/*
516554
* -------------
517555
* Common code

‎src/init.c

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -82,10 +82,6 @@ static bool read_opexpr_const(const OpExpr *opexpr,
8282
constPartRelationInfo*prel,
8383
Datum*value);
8484

85-
#ifPG_VERSION_NUM<100000
86-
staticintoid_cmp(constvoid*p1,constvoid*p2);
87-
#endif
88-
8985

9086
/* Validate SQL facade */
9187
staticuint32build_sql_facade_version(char*version_cstr);
@@ -1127,23 +1123,6 @@ validate_hash_constraint(const Expr *expr,
11271123
return false;
11281124
}
11291125

1130-
#ifPG_VERSION_NUM<100000
1131-
/* needed for find_inheritance_children_array() function */
1132-
staticint
1133-
oid_cmp(constvoid*p1,constvoid*p2)
1134-
{
1135-
Oidv1=*((constOid*)p1);
1136-
Oidv2=*((constOid*)p2);
1137-
1138-
if (v1<v2)
1139-
return-1;
1140-
if (v1>v2)
1141-
return1;
1142-
return0;
1143-
}
1144-
#endif
1145-
1146-
11471126
/* Parse cstring and build uint32 representing the version */
11481127
staticuint32
11491128
build_sql_facade_version(char*version_cstr)

‎src/nodes_common.c

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
*
88
* ------------------------------------------------------------------------
99
*/
10+
#include"compat/pg_compat.h"
1011

1112
#include"init.h"
1213
#include"nodes_common.h"
@@ -175,13 +176,8 @@ tlist_is_var_subset(List *a, List *b)
175176
if (!IsA(te->expr,Var)&& !IsA(te->expr,RelabelType))
176177
continue;
177178

178-
#ifPG_VERSION_NUM >=100000
179-
if (!tlist_member_ignore_relabel(te->expr,a))
180-
return true;
181-
#else
182-
if (!tlist_member_ignore_relabel((Node*)te->expr,a))
179+
if (!tlist_member_ignore_relabel_compat(te->expr,a))
183180
return true;
184-
#endif
185181
}
186182

187183
return false;

‎src/pg_pathman.c

Lines changed: 4 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1575,33 +1575,11 @@ generate_mergeappend_paths(PlannerInfo *root, RelOptInfo *rel,
15751575
else
15761576
{
15771577
/* ... and build the MergeAppend paths */
1578-
#ifPG_VERSION_NUM >=100000
1579-
add_path(rel, (Path*)create_merge_append_path(root,
1580-
rel,
1581-
startup_subpaths,
1582-
pathkeys,
1583-
NULL,
1584-
NULL));
1578+
add_path(rel, (Path*)create_merge_append_path_compat(
1579+
root,rel,startup_subpaths,pathkeys,NULL));
15851580
if (startup_neq_total)
1586-
add_path(rel, (Path*)create_merge_append_path(root,
1587-
rel,
1588-
total_subpaths,
1589-
pathkeys,
1590-
NULL,
1591-
NULL));
1592-
#else
1593-
add_path(rel, (Path*)create_merge_append_path(root,
1594-
rel,
1595-
startup_subpaths,
1596-
pathkeys,
1597-
NULL));
1598-
if (startup_neq_total)
1599-
add_path(rel, (Path*)create_merge_append_path(root,
1600-
rel,
1601-
total_subpaths,
1602-
pathkeys,
1603-
NULL));
1604-
#endif
1581+
add_path(rel, (Path*)create_merge_append_path_compat(
1582+
root,rel,total_subpaths,pathkeys,NULL));
16051583
}
16061584
}
16071585
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp