Skip to content

Fix entity-projection alias in WITH clause causing MATCH to fail - #2544

Open
waterWang wants to merge 1 commit into
apache:masterfrom
waterWang:fix-2538-alias-projection-match
Open

Fix entity-projection alias in WITH clause causing MATCH to fail#2544
waterWang wants to merge 1 commit into
apache:masterfrom
waterWang:fix-2538-alias-projection-match

Conversation

@waterWang

Copy link
Copy Markdown

Fix entity-projection alias in WITH clause causing MATCH to fail

When a vertex variable is renamed via an entity-projection alias in a WITH
clause (e.g. WITH n AS alias0), a subsequent MATCH (alias0) failed with
"variable 'alias0' already exists". The alias was created as a target-list
entry but no transform_entity was registered for the alias name, so
find_variable could not find it.

Fix: in transform_cypher_node, when te != NULL && entity == NULL but the
variable is visible as a column from a previous clause (colNameToVar
returns non-NULL), return the column reference directly instead of
erroring. The caller creates the transform_entity, allowing subsequent
clauses to reference the aliased variable.

Fixes #2538

When a vertex variable is renamed via an entity-projection alias in a WITH
clause (e.g. WITH n AS alias0), a subsequent MATCH (alias0) failed with
"variable 'alias0' already exists". The alias was created as a target-list
entry but no transform_entity was registered for the alias name, so
find_variable could not find it.

Fix: in transform_cypher_node, when te != NULL && entity == NULL but the
variable is visible as a column from a previous clause (colNameToVar
returns non-NULL), return the column reference directly instead of
erroring. The caller creates the transform_entity, allowing subsequent
clauses to reference the aliased variable.

Fixes apache#2538
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

AGE entity-projection alias audit

1 participant