sql-metadata icon indicating copy to clipboard operation
sql-metadata copied to clipboard

Parser.tables returns wrong values when join condition includes COALESCE

Open roman-y opened this issue 7 months ago • 0 comments

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

roman-y avatar May 19 '25 19:05 roman-y