mirror of
https://github.com/postgres/postgres.git
synced 2025-05-02 11:44:50 +03:00
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
This commit is contained in:
parent
7cde649ab1
commit
a01a3d931e
@ -792,6 +792,14 @@ dependency_is_compatible_clause(Node *clause, Index relid, AttrNumber *attnum)
|
||||
|
||||
var = (varonleft) ? linitial(expr->args) : lsecond(expr->args);
|
||||
|
||||
/*
|
||||
* We may ignore any RelabelType node above the operand. (There won't
|
||||
* be more than one, since eval_const_expressions() has been applied
|
||||
* already.)
|
||||
*/
|
||||
if (IsA(var, RelabelType))
|
||||
var = (Var *) ((RelabelType *) var)->arg;
|
||||
|
||||
/* We only support plain Vars for now */
|
||||
if (!IsA(var, Var))
|
||||
return false;
|
||||
|
Loading…
x
Reference in New Issue
Block a user