Skip to content

Conversation

@keiko713
Copy link
Contributor

@keiko713 keiko713 commented Jun 6, 2025

When the query like SELECT col1 FROM t1 WHERE ((SELECT col2 FROM t2 LIMIT 1) IS NULL) is passed, the subselect_items contain the item with the null_test node type.
This null_test node type could contain a table name or a function potentially, but that node type is ignored currently, therefore these table names or functions weren't properly extracted as tables/functions of the query.
With this change, by adding the argument of null_test node to the subselect_items list, the arg will be evaluated again later on and will be properly handled.

keiko713 added 2 commits June 6, 2025 13:33
When the query like SELECT col1 FROM t1 WHERE ((SELECT col2 FROM t2
LIMIT 1) IS NULL) is passed, the subselect_items contain the item with
the null_test node type. This null_test node type could contain a table
name or a function potentially, but that node type is ignored currently,
therefore these table names or functions weren't properly extracted as
tables/functions of the query.
With this change, by adding the argument of null_test node to the
subselect_items list, the arg will be evaluated again later on and will
be properly handled.
@keiko713 keiko713 requested a review from a team June 6, 2025 04:55
@keiko713
Copy link
Contributor Author

Sean pointed out that we try to keep the Ruby and Rust versions in sync, and when I took a Rust version, I noticed that Rust has the code for boolean_test too, which wasn't supported in Ruby version yet.
Looks like both null_test and boolean_test were added in pganalyze/pg_query.rs#21 in Rust side but didn't make it to Ruby side.

@keiko713 keiko713 changed the title Support null_test node type with parsing Support null_test and boolean_test node type with parsing Jun 10, 2025
@keiko713 keiko713 merged commit 6a6556f into main Jun 10, 2025
10 checks passed
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.

3 participants