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

positional parameters with long integer values returns wrong results

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • Major
    • feature-backlog
    • 4.6.4, 5.0.0
    • query
    • None

    Description

      INSERT INTO default VALUES("t1", {"t":"good","longint": 1515026631803155000});
      INSERT INTO default VALUES("t2",{"t":"good","longint": 1515026631804568000});
      INSERT INTO default VALUES("t3",{"t":"good","longint": 1515026631804859000});
      INSERT INTO default VALUES("t4",{"t":"good","longint": 1515026631804990000});
      INSERT INTO default VALUES("t5",{"t":"bad","longint": 1515026765603621000});
      INSERT INTO default VALUES("t6",{"t":"bad","longint": 1515026765604796000});
      INSERT INTO default VALUES("t7",{"t":"bad","longint": 1515026765605058000});
      INSERT INTO default VALUES("t8",{"t":"bad","longint": 1515026765605259000});
      SELECT longint, t from default WHERE longint < 1515026631804859000 AND t = "good" ORDER BY longint DESC limit 10;
      SELECT longint, t from default WHERE longint < 1515026765605058000 AND t = "bad" ORDER BY longint DESC limit 10;
       
      \set  -$l1 1515026631804859000;
      SELECT longint, t from default WHERE longint < $l1 AND t = "good" ORDER BY longint DESC limit 10;
      \set  -args [1515026631804859000];
      SELECT longint, t from default WHERE longint < $1 AND t = "good" ORDER BY longint DESC limit 10;
      \set  -$l1 1515026765605058000;
      SELECT longint, t from default WHERE longint < $l1 AND t = "bad" ORDER BY longint DESC limit 10;
      

      All above selects gives 2 rows
      but the following select gives 3 which is wrong. If same value with constant or named paramters gives right results which are part of above statements.

      This may be due to while decoding positional parameters from request it might be using go Json decoder which all numbers convert to float64 and losing precision. This happens certain numbers that are greater than 2**53

      \set  -args [1515026765605058000];
      SELECT longint, t from default WHERE longint < $1 AND t = "bad" ORDER BY longint DESC limit 10;
      
      

      https://forums.couchbase.com/t/bug-certain-int64-values-fail-to-evaluate-correctly-when-passed-as-positional-parameters-to-query-service-endpoint/15328

      Attachments

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

        Activity

          People

            isha Isha Kandaswamy (Inactive)
            Sitaram.Vemulapalli Sitaram Vemulapalli
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes

                PagerDuty