I am having postgres version 9.6. In one query I have requirement to match null values in where conditions.
select src.* from source src, report prs
where src.id=prs.id and coalesce(src.batch_id, 'null')=coalesce(prs.batch_id, 'null')
Means, it should return all rows where column batch_id is matched or null in both the tables , along with matching id. I could achieve this by applying coalesce function but it will skip the index created in batch_id column.
Please suggest if there is any better way to do.
Thanks