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

Commit4d8be00

Browse files
committed
pathman: sorting bug fixed for ranges
1 parentc758c4b commit4d8be00

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

‎contrib/pg_pathman/init.c

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ HTAB *relations = NULL;
1616
HTAB*range_restrictions=NULL;
1717
boolinitialization_needed= true;
1818

19+
staticFmgrInfo*qsort_type_cmp_func;
1920

2021
staticboolvalidate_range_constraint(Expr*,PartRelationInfo*,Datum*,Datum*);
2122
staticboolvalidate_hash_constraint(Expr*expr,PartRelationInfo*prel,int*hash);
@@ -279,7 +280,12 @@ load_check_constraints(Oid parent_oid)
279280

280281
if (prel->parttype==PT_RANGE)
281282
{
283+
TypeCacheEntry*tce;
284+
282285
/* Sort ascending */
286+
tce=lookup_type_cache(prel->atttype,
287+
TYPECACHE_CMP_PROC |TYPECACHE_CMP_PROC_FINFO);
288+
qsort_type_cmp_func=&tce->cmp_proc_finfo;
283289
qsort(ranges,proc,sizeof(RangeEntry),cmp_range_entries);
284290

285291
/* Copy oids to prel */
@@ -308,11 +314,7 @@ cmp_range_entries(const void *p1, const void *p2)
308314
constRangeEntry*v1= (constRangeEntry*)p1;
309315
constRangeEntry*v2= (constRangeEntry*)p2;
310316

311-
if (v1->min<v2->min)
312-
return-1;
313-
if (v1->min>v2->min)
314-
return1;
315-
return0;
317+
returnFunctionCall2(qsort_type_cmp_func,v1->min,v2->min);
316318
}
317319

318320
/*

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp