From 3a0a16cb7e2aba8d9864d117d1199181432b42b8 Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Wed, 25 Jan 2006 20:29:24 +0000 Subject: Allow row comparisons to be used as indexscan qualifications. This completes the project to upgrade our handling of row comparisons. --- src/backend/utils/adt/selfuncs.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'src/backend/utils/adt/selfuncs.c') diff --git a/src/backend/utils/adt/selfuncs.c b/src/backend/utils/adt/selfuncs.c index 336c1deaeaa..cb9acf2d8a3 100644 --- a/src/backend/utils/adt/selfuncs.c +++ b/src/backend/utils/adt/selfuncs.c @@ -15,7 +15,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/utils/adt/selfuncs.c,v 1.196 2006/01/14 00:14:11 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/utils/adt/selfuncs.c,v 1.197 2006/01/25 20:29:24 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -4657,6 +4657,9 @@ btcostestimate(PG_FUNCTION_ARGS) * to find out which ones count as boundary quals. We rely on the * knowledge that they are given in index column order. * + * For a RowCompareExpr, we consider only the first column, just as + * rowcomparesel() does. + * * If there's a ScalarArrayOpExpr in the quals, we'll actually perform * N index scans not one, but the ScalarArrayOpExpr's operator can be * considered to act the same as it normally does. @@ -4682,6 +4685,14 @@ btcostestimate(PG_FUNCTION_ARGS) rightop = get_rightop(clause); clause_op = ((OpExpr *) clause)->opno; } + else if (IsA(clause, RowCompareExpr)) + { + RowCompareExpr *rc = (RowCompareExpr *) clause; + + leftop = (Node *) linitial(rc->largs); + rightop = (Node *) linitial(rc->rargs); + clause_op = linitial_oid(rc->opnos); + } else if (IsA(clause, ScalarArrayOpExpr)) { ScalarArrayOpExpr *saop = (ScalarArrayOpExpr *) clause; -- cgit v1.2.3