Description
Improvement: SQL databases have various degrees of implicit type conversion.
N1QL needs explicit type conversion. Ask is to support implicity type conversion.
SQL:
SELECT primary_key_id FROM simple_table WHERE COALESCE(decimal_field1, 10, 20, 30) > 0 GROUP BY primary_key_id HAVING SUM(COALESCE(primary_key_id, 10)) > 0 ORDER BY primary_key_id limit 2;
results:
1
10
N1QL:
SELECT primary_key_id FROM simple_table_db_94531761_simple_table WHERE COALESCE(decimal_field1, 10, 20, 30) > 0 GROUP BY primary_key_id HAVING SUM(COALESCE(primary_key_id, 10)) > 0 ORDER BY primary_key_id limit 2
results:
[]
HAVING keyword breaks everything
MySQL engine converts varchar to number automatically, Couch needs to call tonumber() function explicitly