Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-25871

compare error bigint to varchar

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Critical
    • Resolution: Not a Bug
    • Affects Version/s: 10.2.38
    • Fix Version/s: N/A
    • Component/s: Data types, OTHER
    • Labels:
      None
    • Environment:
      Linux jitsi.kgs-born.de 4.15.0-144-generic #148-Ubuntu SMP Sat May 8 02:33:43 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux

      Description

      If i compare a bigint with a varchar i get a wrong result

      here a sample:

      This query should only find 1 row, but it returns 2 rows

      MariaDB [bernd]> desc big;
      +-------+------------------+------+-----+---------+----------------+
      | Field | Type             | Null | Key | Default | Extra          |
      +-------+------------------+------+-----+---------+----------------+
      | id    | int(11) unsigned | NO   | PRI | NULL    | auto_increment |
      | bi    | bigint(11)       | YES  |     | NULL    |                |
      | vc    | varchar(20)      | YES  |     | NULL    |                |
      +-------+------------------+------+-----+---------+----------------+
      3 rows in set (0.01 sec)
       
      MariaDB [bernd]> select * from big;
      +----+--------------------+--------------------+
      | id | bi                 | vc                 |
      +----+--------------------+--------------------+
      |  1 | 137226000008073943 | 137226000008073943 |
      |  2 | 137226000008073929 | 137226000008073929 |
      +----+--------------------+--------------------+
      2 rows in set (0.05 sec)
       
      MariaDB [bernd]> select * from big where vc = 137226000008073943;
      +----+--------------------+--------------------+
      | id | bi                 | vc                 |
      +----+--------------------+--------------------+
      |  1 | 137226000008073943 | 137226000008073943 |
      |  2 | 137226000008073929 | 137226000008073929 |
      +----+--------------------+--------------------+
      2 rows in set (0.00 sec)
       
      MariaDB [bernd]> 
      

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              alice Alice Sherepa
              Reporter:
              Bernd Buffen Bernd Buffen
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:

                  Git Integration