1
0
mirror of https://github.com/postgres/postgres.git synced 2025-10-19 15:49:24 +03:00

Simplify relation_has_unique_index_for()

Now that the only call to relation_has_unique_index_for() that
supplied an exprlist and oprlist has been removed, the loop handling
those lists is effectively dead code.  This patch removes that loop
and simplifies the function accordingly.

Author: Richard Guo <guofenglinux@gmail.com>
Discussion: https://postgr.es/m/CAMbWs4-EBnaRvEs7frTLbsXiweSTUXifsteF-d3rvv01FKO86w@mail.gmail.com
This commit is contained in:
Richard Guo
2025-08-19 09:37:04 +09:00
parent 24225ad9aa
commit bf9ee294e5
3 changed files with 17 additions and 78 deletions

View File

@@ -990,11 +990,10 @@ rel_is_distinct_for(PlannerInfo *root, RelOptInfo *rel, List *clause_list,
{
/*
* Examine the indexes to see if we have a matching unique index.
* relation_has_unique_index_ext automatically adds any usable
* relation_has_unique_index_for automatically adds any usable
* restriction clauses for the rel, so we needn't do that here.
*/
if (relation_has_unique_index_ext(root, rel, clause_list, NIL, NIL,
extra_clauses))
if (relation_has_unique_index_for(root, rel, clause_list, extra_clauses))
return true;
}
else if (rel->rtekind == RTE_SUBQUERY)