|
35 | 35 | #include "utils/lsyscache.h" |
36 | 36 | #include "utils/selfuncs.h" |
37 | 37 |
|
| 38 | +/* Hook for extensions to provide index clauses for unmatched OpExpr */ |
| 39 | +match_opclause_to_indexcol_hook_type match_opclause_to_indexcol_hook = NULL; |
38 | 40 |
|
39 | 41 | /* XXX see PartCollMatchesExprColl */ |
40 | 42 | #define IndexCollMatchesExprColl(idxcollation, exprcollation) \ |
@@ -2451,12 +2453,17 @@ match_opclause_to_indexcol(PlannerInfo *root, |
2451 | 2453 | * function for the operator's underlying function. |
2452 | 2454 | */ |
2453 | 2455 | set_opfuncid(clause); /* make sure we have opfuncid */ |
2454 | | - return get_index_clause_from_support(root, |
| 2456 | + iclause = get_index_clause_from_support(root, |
2455 | 2457 | rinfo, |
2456 | 2458 | clause->opfuncid, |
2457 | 2459 | 0, /* indexarg on left */ |
2458 | 2460 | indexcol, |
2459 | 2461 | index); |
| 2462 | + if (iclause) |
| 2463 | + return iclause; |
| 2464 | + if (match_opclause_to_indexcol_hook) |
| 2465 | + return match_opclause_to_indexcol_hook(root, rinfo, indexcol, index); |
| 2466 | + return NULL; |
2460 | 2467 | } |
2461 | 2468 |
|
2462 | 2469 | if (match_index_to_operand(rightop, indexcol, index) && |
@@ -2491,12 +2498,17 @@ match_opclause_to_indexcol(PlannerInfo *root, |
2491 | 2498 | * function for the operator's underlying function. |
2492 | 2499 | */ |
2493 | 2500 | set_opfuncid(clause); /* make sure we have opfuncid */ |
2494 | | - return get_index_clause_from_support(root, |
| 2501 | + iclause = get_index_clause_from_support(root, |
2495 | 2502 | rinfo, |
2496 | 2503 | clause->opfuncid, |
2497 | 2504 | 1, /* indexarg on right */ |
2498 | 2505 | indexcol, |
2499 | 2506 | index); |
| 2507 | + if (iclause) |
| 2508 | + return iclause; |
| 2509 | + if (match_opclause_to_indexcol_hook) |
| 2510 | + return match_opclause_to_indexcol_hook(root, rinfo, indexcol, index); |
| 2511 | + return NULL; |
2500 | 2512 | } |
2501 | 2513 |
|
2502 | 2514 | return NULL; |
|
0 commit comments