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

Commit484551a

Browse files
committed
collation support (not finished)
1 parentd98e1af commit484551a

File tree

2 files changed

+25
-5
lines changed

2 files changed

+25
-5
lines changed

‎src/pathman.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,7 @@ void select_range_partitions(const Datum value,
167167
constRangeEntry*ranges,
168168
constintnranges,
169169
constintstrategy,
170+
Oidcollid,
170171
WrapperNode*result);
171172

172173
/* Examine expression in order to select partitions. */

‎src/pg_pathman.c

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -453,6 +453,7 @@ select_range_partitions(const Datum value,
453453
constRangeEntry*ranges,
454454
constintnranges,
455455
constintstrategy,
456+
Oidcollid,
456457
WrapperNode*result)
457458
{
458459
constRangeEntry*current_re;
@@ -487,9 +488,9 @@ select_range_partitions(const Datum value,
487488

488489
/* Corner cases */
489490
cmp_min=IsInfinite(&ranges[startidx].min) ?
490-
1 :DatumGetInt32(FunctionCall2(cmp_func,value,BoundGetValue(&ranges[startidx].min)));
491+
1 :DatumGetInt32(FunctionCall2Coll(cmp_func,collid,value,BoundGetValue(&ranges[startidx].min)));
491492
cmp_max=IsInfinite(&ranges[endidx].max) ?
492-
-1 :DatumGetInt32(FunctionCall2(cmp_func,value,BoundGetValue(&ranges[endidx].max)));
493+
-1 :DatumGetInt32(FunctionCall2Coll(cmp_func,collid,value,BoundGetValue(&ranges[endidx].max)));
493494

494495
if ((cmp_min <=0&&strategy==BTLessStrategyNumber)||
495496
(cmp_min<0&& (strategy==BTLessEqualStrategyNumber||
@@ -745,8 +746,10 @@ walk_expr_tree(Expr *expr, WalkerContext *context)
745746
* This function determines which partitions should appear in query plan.
746747
*/
747748
staticvoid
748-
handle_binary_opexpr(WalkerContext*context,WrapperNode*result,
749-
constNode*varnode,constConst*c)
749+
handle_binary_opexpr(WalkerContext*context,
750+
WrapperNode*result,
751+
constNode*varnode,
752+
constConst*c)
750753
{
751754
intstrategy;
752755
TypeCacheEntry*tce;
@@ -795,7 +798,20 @@ handle_binary_opexpr(WalkerContext *context, WrapperNode *result,
795798

796799
casePT_RANGE:
797800
{
798-
FmgrInfocmp_func;
801+
FmgrInfocmp_func;
802+
Oidcollid;
803+
804+
/*
805+
* If operator collation is different from default attribute
806+
* collation then we cannot guarantee that we return correct
807+
* partitions. So in this case we just return all of them
808+
*/
809+
if (expr->opcollid!=prel->attcollid&&strategy!=BTEqualStrategyNumber)
810+
gotobinary_opexpr_return;
811+
812+
collid=OidIsValid(expr->opcollid) ?
813+
expr->opcollid :
814+
prel->attcollid;
799815

800816
fill_type_cmp_fmgr_info(&cmp_func,
801817
getBaseType(c->consttype),
@@ -806,6 +822,7 @@ handle_binary_opexpr(WalkerContext *context, WrapperNode *result,
806822
PrelGetRangesArray(context->prel),
807823
PrelChildrenCount(context->prel),
808824
strategy,
825+
collid,
809826
result);/* output */
810827

811828
result->paramsel=estimate_paramsel_using_prel(prel,strategy);
@@ -893,6 +910,7 @@ search_range_partition_eq(const Datum value,
893910
ranges,
894911
nranges,
895912
BTEqualStrategyNumber,
913+
prel->attcollid,
896914
&result);/* output */
897915

898916
if (result.found_gap)
@@ -1001,6 +1019,7 @@ handle_const(const Const *c, WalkerContext *context)
10011019
PrelGetRangesArray(context->prel),
10021020
PrelChildrenCount(context->prel),
10031021
strategy,
1022+
prel->attcollid,
10041023
result);/* output */
10051024

10061025
result->paramsel=estimate_paramsel_using_prel(prel,strategy);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp