Content-Length: 268737 | pFad | http://github.com/postgrespro/postgres_cluster/commit/86e4ebb9af7ed07f11410d568e0fd72427f3b0e3

62 Allow rel_is_distinct_for() to look through RelabelType below OpExpr. · postgrespro/postgres_cluster@86e4ebb · GitHub
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)








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/postgrespro/postgres_cluster/commit/86e4ebb9af7ed07f11410d568e0fd72427f3b0e3

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy