Skip to content

Commit a01a3d9

Browse files
committed
Infer functional dependency past RelabelType
Vars hidden within a RelabelType would not be detected as compatible with some functional dependency. Repair by properly ignoring the RelabelType. Author: David Rowley Reviewed-by: Tomas Vondra Discussion: https://postgr.es/m/CAKJS1f-y-UEy=rsBXynBOgiW1fKMr_LVoYSGL9QOc36mLEC-ww@mail.gmail.com
1 parent 7cde649 commit a01a3d9

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/backend/statistics/dependencies.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -792,6 +792,14 @@ dependency_is_compatible_clause(Node *clause, Index relid, AttrNumber *attnum)
792792

793793
var = (varonleft) ? linitial(expr->args) : lsecond(expr->args);
794794

795+
/*
796+
* We may ignore any RelabelType node above the operand. (There won't
797+
* be more than one, since eval_const_expressions() has been applied
798+
* already.)
799+
*/
800+
if (IsA(var, RelabelType))
801+
var = (Var *) ((RelabelType *) var)->arg;
802+
795803
/* We only support plain Vars for now */
796804
if (!IsA(var, Var))
797805
return false;

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