* Comparison function for elements. * * We use the element type's default btree opclass, and its default collation * if the type is collation-sensitive. * * XXX consider using SortSupport infrastructure */
| 1163 | * XXX consider using SortSupport infrastructure |
| 1164 | */ |
| 1165 | static int |
| 1166 | element_compare(const void *key1, const void *key2, void *arg) |
| 1167 | { |
| 1168 | Datum d1 = *((const Datum *) key1); |
| 1169 | Datum d2 = *((const Datum *) key2); |
| 1170 | TypeCacheEntry *typentry = (TypeCacheEntry *) arg; |
| 1171 | FmgrInfo *cmpfunc = &typentry->cmp_proc_finfo; |
| 1172 | Datum c; |
| 1173 | |
| 1174 | c = FunctionCall2Coll(cmpfunc, typentry->typcollation, d1, d2); |
| 1175 | return DatumGetInt32(c); |
| 1176 | } |
| 1177 | |
| 1178 | /* |
| 1179 | * Comparison function for sorting floats into descending order. |
no test coverage detected