sql-metadata
sql-metadata copied to clipboard
Parser.tables returns wrong values when join condition includes COALESCE
using tables: List[str] = Parser(sql_file_content).tables
where part of sql_file_content is
INNER JOIN my_db_name.ipps_wage_index_annual WI ON OPR.year = WI.cms_year
INNER JOIN my_db_name.geo_county_cbsa CBS ON WI.cbsa_cd = COALESCE(CBS.metropolitan_division_code, CBS.cbsa_code, SUBSTRING(CBS.ssa_codes, 1, 2))
INNER JOIN ...
returns CBS.cbsa_code CBS.ssa_codes as tables