This is an automated email from the ASF dual-hosted git repository.

rafsun42 pushed a commit to branch PG12
in repository https://gitbox.apache.org/repos/asf/age.git


The following commit(s) were added to refs/heads/PG12 by this push:
     new 39e696af Add an additional way to find a previous variable ref (#1450) 
(#1480)
39e696af is described below

commit 39e696af9538ede887334b7daa4b1b0822fe7a8c
Author: John Gemignani <[email protected]>
AuthorDate: Tue Jan 2 16:43:04 2024 -0800

    Add an additional way to find a previous variable ref (#1450) (#1480)
    
    Added an additional way to find a previous variable reference to
    `transform_column_ref_for_indirection`.
    
    There was no impact on current regression tests.
    
    Resolved -
    Conflicts:
            src/backend/parser/cypher_expr.c
---
 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 cbb250e5..18d500ba 100644
--- a/src/backend/parser/cypher_expr.c
+++ b/src/backend/parser/cypher_expr.c
@@ -841,10 +841,16 @@ static Node 
*transform_column_ref_for_indirection(cypher_parsestate *cpstate,
     /* locate the referenced RTE */
     rte = find_rte(cpstate, relname);
 
-    /* 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 (!rte)
     {
-        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 */

Reply via email to