@@ -2742,7 +2742,8 @@ compute_partition_hash_value(int partnatts, FmgrInfo *partsupfunc, Oid *partcoll
2742
2742
* datatype-specific hash functions of each partition key
2743
2743
* attribute.
2744
2744
*/
2745
- hash = FunctionCall2Coll (& partsupfunc [i ], partcollation [i ], values [i ], seed );
2745
+ hash = FunctionCall2Coll (& partsupfunc [i ], partcollation [i ],
2746
+ values [i ], seed );
2746
2747
2747
2748
/* Form a single 64-bit hash value */
2748
2749
rowHash = hash_combine64 (rowHash , DatumGetUInt64 (hash ));
@@ -2777,7 +2778,8 @@ satisfies_hash_partition(PG_FUNCTION_ARGS)
2777
2778
int16 variadic_typlen ;
2778
2779
bool variadic_typbyval ;
2779
2780
char variadic_typalign ;
2780
- FmgrInfo partsupfunc [PARTITION_MAX_KEYS ];
2781
+ Oid partcollid [PARTITION_MAX_KEYS ];
2782
+ FmgrInfo partsupfunc [FLEXIBLE_ARRAY_MEMBER ];
2781
2783
} ColumnsHashData ;
2782
2784
Oid parentId ;
2783
2785
int modulus ;
@@ -2850,6 +2852,8 @@ satisfies_hash_partition(PG_FUNCTION_ARGS)
2850
2852
my_extra = (ColumnsHashData * ) fcinfo -> flinfo -> fn_extra ;
2851
2853
my_extra -> relid = parentId ;
2852
2854
my_extra -> nkeys = key -> partnatts ;
2855
+ memcpy (my_extra -> partcollid , key -> partcollation ,
2856
+ key -> partnatts * sizeof (Oid ));
2853
2857
2854
2858
/* check argument types and save fmgr_infos */
2855
2859
for (j = 0 ; j < key -> partnatts ; ++ j )
@@ -2866,7 +2870,6 @@ satisfies_hash_partition(PG_FUNCTION_ARGS)
2866
2870
& key -> partsupfunc [j ],
2867
2871
fcinfo -> flinfo -> fn_mcxt );
2868
2872
}
2869
-
2870
2873
}
2871
2874
else
2872
2875
{
@@ -2885,6 +2888,7 @@ satisfies_hash_partition(PG_FUNCTION_ARGS)
2885
2888
& my_extra -> variadic_typlen ,
2886
2889
& my_extra -> variadic_typbyval ,
2887
2890
& my_extra -> variadic_typalign );
2891
+ my_extra -> partcollid [0 ] = key -> partcollation [0 ];
2888
2892
2889
2893
/* check argument types */
2890
2894
for (j = 0 ; j < key -> partnatts ; ++ j )
@@ -2926,11 +2930,10 @@ satisfies_hash_partition(PG_FUNCTION_ARGS)
2926
2930
if (PG_ARGISNULL (argno ))
2927
2931
continue ;
2928
2932
2929
- Assert (OidIsValid (my_extra -> partsupfunc [i ].fn_oid ));
2930
-
2931
- hash = FunctionCall2 (& my_extra -> partsupfunc [i ],
2932
- PG_GETARG_DATUM (argno ),
2933
- seed );
2933
+ hash = FunctionCall2Coll (& my_extra -> partsupfunc [i ],
2934
+ my_extra -> partcollid [i ],
2935
+ PG_GETARG_DATUM (argno ),
2936
+ seed );
2934
2937
2935
2938
/* Form a single 64-bit hash value */
2936
2939
rowHash = hash_combine64 (rowHash , DatumGetUInt64 (hash ));
@@ -2965,11 +2968,10 @@ satisfies_hash_partition(PG_FUNCTION_ARGS)
2965
2968
if (isnull [i ])
2966
2969
continue ;
2967
2970
2968
- Assert (OidIsValid (my_extra -> partsupfunc [0 ].fn_oid ));
2969
-
2970
- hash = FunctionCall2 (& my_extra -> partsupfunc [0 ],
2971
- datum [i ],
2972
- seed );
2971
+ hash = FunctionCall2Coll (& my_extra -> partsupfunc [0 ],
2972
+ my_extra -> partcollid [0 ],
2973
+ datum [i ],
2974
+ seed );
2973
2975
2974
2976
/* Form a single 64-bit hash value */
2975
2977
rowHash = hash_combine64 (rowHash , DatumGetUInt64 (hash ));
0 commit comments