Uploaded image for project: 'Couchbase Server'
  1. Couchbase Server
  2. MB-31154

difference in SQL and N1QL result sets

    XMLWordPrintable

Details

    • Improvement
    • Resolution: Won't Fix
    • Major
    • 6.5.0
    • 6.5.0
    • query

    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

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            keshav Keshav Murthy
            evgeny.makarenko Evgeny Makarenko (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes

                PagerDuty