Skip to content

fix: exclude internal VLE helper vars from RETURN * expansion (#2540) - #2545

Open
waterWang wants to merge 1 commit into
apache:masterfrom
waterWang:fix-vle-return-star
Open

fix: exclude internal VLE helper vars from RETURN * expansion (#2540)#2545
waterWang wants to merge 1 commit into
apache:masterfrom
waterWang:fix-vle-return-star

Conversation

@waterWang

Copy link
Copy Markdown

Description

Fixes #2540

MATCH p = ()-[*1]->(n:End {id: 2})
RETURN *

fails with ERROR: return row and column definition list do not match while the equivalent explicit RETURN p, n succeeds.

Root cause

When a variable-length edge pattern has no explicit start/end variable, build_VLE_relation in cypher_gram.y assigns internal helper names via create_unique_name(AGE_DEFAULT_PREFIX"vle_function_{start,end}_var") (e.g. _age_default_vle_function_start_var_1). Those columns land in the parse namespace and are picked up by RETURN * expansion (ExpandAllTables -> expand_pnsi_attrs). The SRF is then invoked with one extra column, producing the row/column mismatch error.

Fix

In expand_pnsi_attrs, skip columns whose name begins with AGE_DEFAULT_PREFIX "vle_function_", the same way the existing hidden-var (AGE_DEFAULT_VARNAME_PREFIX) and hidden-alias (AGE_DEFAULT_ALIAS_PREFIX) filters work.

Verification

  • make installcheck: 41/43 pass (only pre-existing age_load/file-path and age_upgrade env failures, unrelated to this change)
  • Manual repro now returns the expected (n, p) columns matching the AGE convention that RETURN * orders entities before the path variable

…#2540)

When a variable-length edge pattern assigns internal helper column names
via create_unique_name(AGE_DEFAULT_PREFIX"vle_function_{start,end}_var")
in cypher_gram.y, those columns land in the namespace and are picked up
by RETURN * expansion (ExpandAllTables -> expand_pnsi_attrs). The SRF is
then invoked with one column more than the caller's column definition
list declares, producing:

  ERROR: return row and column definition list do not match

e.g.

  MATCH p = ()-[*1]->(n:End {id: 2})
  RETURN *
  AS (p agtype, n agtype)

Filter out the internal VLE helper columns in expand_pnsi_attrs the same
way hidden vars/aliases are already excluded. Regression-tested with
make installcheck: 41/43 pass (age_load/age_upgrade fail for pre-existing
environment reasons unrelated to this change).
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.

Variable-length path with RETURN * fails with a row/column definition error

1 participant