#include "access/attnum.h"

Go to the source code of this file.
Data Structures | |
| struct | SortSupportData |
Typedefs | |
| typedef struct SortSupportData * | SortSupport |
| typedef struct SortSupportData | SortSupportData |
Functions | |
| int | ApplySortComparator (Datum datum1, bool isNull1, Datum datum2, bool isNull2, SortSupport ssup) |
| void | PrepareSortSupportComparisonShim (Oid cmpFunc, SortSupport ssup) |
| void | PrepareSortSupportFromOrderingOp (Oid orderingOp, SortSupport ssup) |
| typedef struct SortSupportData* SortSupport |
Definition at line 52 of file sortsupport.h.
| typedef struct SortSupportData SortSupportData |
| int ApplySortComparator | ( | Datum | datum1, | |
| bool | isNull1, | |||
| Datum | datum2, | |||
| bool | isNull2, | |||
| SortSupport | ssup | |||
| ) |
Referenced by compare_scalars(), comparetup_datum(), comparetup_heap(), heap_compare_slots(), and MJCompare().
| void PrepareSortSupportComparisonShim | ( | Oid | cmpFunc, | |
| SortSupport | ssup | |||
| ) |
Definition at line 67 of file sortsupport.c.
References FunctionCallInfoData::argnull, SortSupportData::comparator, SortShimExtra::fcinfo, SortShimExtra::flinfo, fmgr_info_cxt(), InitFunctionCallInfoData, MemoryContextAlloc(), NULL, SortSupportData::ssup_collation, SortSupportData::ssup_cxt, and SortSupportData::ssup_extra.
Referenced by MJExamineQuals(), and PrepareSortSupportFromOrderingOp().
{
SortShimExtra *extra;
extra = (SortShimExtra *) MemoryContextAlloc(ssup->ssup_cxt,
sizeof(SortShimExtra));
/* Lookup the comparison function */
fmgr_info_cxt(cmpFunc, &extra->flinfo, ssup->ssup_cxt);
/* We can initialize the callinfo just once and re-use it */
InitFunctionCallInfoData(extra->fcinfo, &extra->flinfo, 2,
ssup->ssup_collation, NULL, NULL);
extra->fcinfo.argnull[0] = false;
extra->fcinfo.argnull[1] = false;
ssup->ssup_extra = extra;
ssup->comparator = comparison_shim;
}
| void PrepareSortSupportFromOrderingOp | ( | Oid | orderingOp, | |
| SortSupport | ssup | |||
| ) |
Definition at line 95 of file sortsupport.c.
References Assert, SortSupportData::comparator, elog, ERROR, get_sort_function_for_ordering_op(), NULL, OidFunctionCall1, PointerGetDatum, PrepareSortSupportComparisonShim(), and SortSupportData::ssup_reverse.
Referenced by compute_scalar_stats(), ExecInitMergeAppend(), tuplesort_begin_datum(), and tuplesort_begin_heap().
{
Oid sortFunction;
bool issupport;
if (!get_sort_function_for_ordering_op(orderingOp,
&sortFunction,
&issupport,
&ssup->ssup_reverse))
elog(ERROR, "operator %u is not a valid ordering operator",
orderingOp);
if (issupport)
{
/* The sort support function should provide a comparator */
OidFunctionCall1(sortFunction, PointerGetDatum(ssup));
Assert(ssup->comparator != NULL);
}
else
{
/* We'll use a shim to call the old-style btree comparator */
PrepareSortSupportComparisonShim(sortFunction, ssup);
}
}
1.7.1