Skip to content

parse_functions: find functions inside FROM-clause subqueries, joins and table-function arguments - #2

Closed
asubbarao wants to merge 1 commit into
teaguesterling:mainfrom
asubbarao:fix/function-names-in-from-subquery
Closed

asubbarao wants to merge 1 commit into
teaguesterling:mainfrom
asubbarao:fix/function-names-in-from-subquery

Conversation

@asubbarao

Copy link
Copy Markdown

parse_function_names / parse_functions only walk the SELECT list, WHERE, GROUP BY, HAVING and CTEs. Anything in the FROM clause is skipped:

SELECT parse_function_names('SELECT * FROM (SELECT avg(n) AS a FROM range(5) t(n)) s');
-- before: []    after: [avg]

This walks from_table (subqueries, both sides and the condition of a join, table-function arguments) and scalar subqueries in expressions, following the same TableReferenceType pattern parse_tables.cpp already uses.

query before after
FROM (SELECT avg(n) …) s [] [avg]
FROM (SELECT upper(x) …) a JOIN (SELECT lower(y) …) b [] [upper, lower]
FROM range(abs(-5)) [] [abs]
SELECT (SELECT sum(1)) WHERE x IN (SELECT length(z) …) [] [sum, length]

Tests added to both parse_function_names.test and parse_functions.test; full suite passes (289 assertions in 8 test cases).

🤖 Generated with Claude Code

@asubbarao
asubbarao force-pushed the fix/function-names-in-from-subquery branch from d91d69d to d7baad5 Compare September 23, 2026 18:44
@asubbarao

Copy link
Copy Markdown
Author

Wrong repository: the parser_tools community extension is built from hotdata-dev/duckdb_extension_parser_tools. The same fix, ported to that repo's current code, is hotdata-dev#17. Closing this one.

@asubbarao asubbarao closed this Sep 24, 2026
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.

1 participant