Skip to content

Commit 86e4ebb

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 c0d21bd commit 86e4ebb

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
@@ -617,6 +617,14 @@ rel_is_distinct_for(PlannerInfo *root, RelOptInfo *rel, List *clause_list)
617617
else
618618
var = (Var *) get_leftop(rinfo->clause);
619619

620+
/*
621+
* We may ignore any RelabelType node above the operand. (There
622+
* won't be more than one, since eval_const_expressions() has been
623+
* applied already.)
624+
*/
625+
if (var && IsA(var, RelabelType))
626+
var = (Var *) ((RelabelType *) var)->arg;
627+
620628
/*
621629
* If inner side isn't a Var referencing a subquery output column,
622630
* 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