Skip to content

Commit 6f44fe7

Browse files
committed
Allow rel_is_distinct_for() to look through RelabelType below OpExpr.
This lets it do the right thing for, eg, varchar columns. Back-patch to 9.5 where this logic appeared. David Rowley, per report from Kim Rose Carlsen Discussion: https://postgr.es/m/VI1PR05MB17091F9A9876528055D6A827C76D0@VI1PR05MB1709.eurprd05.prod.outlook.com
1 parent 27c6619 commit 6f44fe7

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/backend/optimizer/plan/analyzejoins.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -703,6 +703,14 @@ rel_is_distinct_for(PlannerInfo *root, RelOptInfo *rel, List *clause_list)
703703
else
704704
var = (Var *) get_leftop(rinfo->clause);
705705

706+
/*
707+
* We may ignore any RelabelType node above the operand. (There
708+
* won't be more than one, since eval_const_expressions() has been
709+
* applied already.)
710+
*/
711+
if (var && IsA(var, RelabelType))
712+
var = (Var *) ((RelabelType *) var)->arg;
713+
706714
/*
707715
* If inner side isn't a Var referencing a subquery output column,
708716
* this clause doesn't help us.

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy