I have a relation in PostgreSQL named product which contains 2 fields: id and quantity, and I want to find the id of the
product
id
quantity
Your queries are NOT equivalent. The first returns no rows at all if any of the quantity values are NULL. The second ignores NULL values.
NULL
Here is a db<>fiddle illustrating this.