Skip to content

What is the best way to check if a query uses a star? #294

Open
@kduraiswami

Description

@kduraiswami

I am able to go all the way down into a query node like this

parsed_query.tree.stmts[0].stmt.select_stmt.target_list[0].res_target.val.column_ref.fields[0].respond_to?(:a_star)

but in ruby the method respond_to? is too loose because even if a query does not have a star in it the object itself does have this method.

Is this the most efficient way to traverse through the tree and ask if it has a star and try to access the property? Is there a risk this will return true even if it is not the case?

parsed_query.tree.stmts[0].stmt.select_stmt.target_list[0].res_target.val.column_ref.fields[0]["a_star"]

Thanks for the help, please let me know if I can clarify anything

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions