mirror of
https://github.com/postgres/postgres.git
synced 2025-09-05 02:22:28 +03:00
Pass collations to functions in FunctionCallInfoData, not FmgrInfo.
Since collation is effectively an argument, not a property of the function, FmgrInfo is really the wrong place for it; and this becomes critical in cases where a cached FmgrInfo is used for varying purposes that might need different collation settings. Fix by passing it in FunctionCallInfoData instead. In particular this allows a clean fix for bug #5970 (record_cmp not working). This requires touching a bit more code than the original method, but nobody ever thought that collations would not be an invasive patch...
This commit is contained in:
@@ -60,7 +60,8 @@ typedef struct Tuplesortstate Tuplesortstate;
|
||||
|
||||
extern Tuplesortstate *tuplesort_begin_heap(TupleDesc tupDesc,
|
||||
int nkeys, AttrNumber *attNums,
|
||||
Oid *sortOperators, Oid *collations, bool *nullsFirstFlags,
|
||||
Oid *sortOperators, Oid *sortCollations,
|
||||
bool *nullsFirstFlags,
|
||||
int workMem, bool randomAccess);
|
||||
extern Tuplesortstate *tuplesort_begin_cluster(TupleDesc tupDesc,
|
||||
Relation indexRel,
|
||||
@@ -72,7 +73,8 @@ extern Tuplesortstate *tuplesort_begin_index_hash(Relation indexRel,
|
||||
uint32 hash_mask,
|
||||
int workMem, bool randomAccess);
|
||||
extern Tuplesortstate *tuplesort_begin_datum(Oid datumType,
|
||||
Oid sortOperator, Oid sortCollation, bool nullsFirstFlag,
|
||||
Oid sortOperator, Oid sortCollation,
|
||||
bool nullsFirstFlag,
|
||||
int workMem, bool randomAccess);
|
||||
|
||||
extern void tuplesort_set_bound(Tuplesortstate *state, int64 bound);
|
||||
@@ -125,6 +127,7 @@ extern void SelectSortFunction(Oid sortOperator, bool nulls_first,
|
||||
* reverse-sort and NULLs-ordering properly.
|
||||
*/
|
||||
extern int32 ApplySortFunction(FmgrInfo *sortFunction, int sortFlags,
|
||||
Oid collation,
|
||||
Datum datum1, bool isNull1,
|
||||
Datum datum2, bool isNull2);
|
||||
|
||||
|
Reference in New Issue
Block a user