From c26f4f087248ef3497f1227b7c045ac26a530ebe Mon Sep 17 00:00:00 2001 From: John Gemignani Date: Tue, 2 Jan 2024 16:17:47 -0800 Subject: [PATCH] Add an additional way to find a previous variable ref (#1450) (#1477) Added an additional way to find a previous variable reference to `transform_column_ref_for_indirection`. There was no impact on current regression tests. --- src/backend/parser/cypher_expr.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/backend/parser/cypher_expr.c b/src/backend/parser/cypher_expr.c index 0c288542d..b2b49f823 100644 --- a/src/backend/parser/cypher_expr.c +++ b/src/backend/parser/cypher_expr.c @@ -977,10 +977,16 @@ static Node *transform_column_ref_for_indirection(cypher_parsestate *cpstate, pnsi = refnameNamespaceItem(pstate, NULL, relname, cr->location, &levels_up); - /* if we didn't find anything, return NULL */ + /* + * If we didn't find anything, try looking for a previous variable + * reference. Otherwise, return NULL (colNameToVar will return NULL + * if nothing is found). + */ if (!pnsi) { - return NULL; + Node *prev_var = colNameToVar(pstate, relname, false, cr->location); + + return prev_var; } /* find the properties column of the NSI and return a var for it */