* Set up a shim function to allow use of an old-style btree comparison * function as if it were a sort support comparator. */
| 66 | * function as if it were a sort support comparator. |
| 67 | */ |
| 68 | void |
| 69 | PrepareSortSupportComparisonShim(Oid cmpFunc, SortSupport ssup) |
| 70 | { |
| 71 | SortShimExtra *extra; |
| 72 | |
| 73 | extra = (SortShimExtra *) MemoryContextAlloc(ssup->ssup_cxt, |
| 74 | SizeForSortShimExtra(2)); |
| 75 | |
| 76 | /* Lookup the comparison function */ |
| 77 | fmgr_info_cxt(cmpFunc, &extra->flinfo, ssup->ssup_cxt); |
| 78 | |
| 79 | /* We can initialize the callinfo just once and re-use it */ |
| 80 | InitFunctionCallInfoData(extra->fcinfo, &extra->flinfo, 2, |
| 81 | ssup->ssup_collation, NULL, NULL); |
| 82 | extra->fcinfo.args[0].isnull = false; |
| 83 | extra->fcinfo.args[1].isnull = false; |
| 84 | |
| 85 | ssup->ssup_extra = extra; |
| 86 | ssup->comparator = comparison_shim; |
| 87 | } |
| 88 | |
| 89 | /* |
| 90 | * Look up and call sortsupport function to setup SortSupport comparator; |
no test coverage detected