#3693 (ok 3.5.4) Invalid SELECT statement when enum field present

3.5.3
fixed
1
2013-06-11
2012-10-11
Jørgen Thomsen
No

A table has the following fields (among others)

nr int(6)
kundetype enum('normal', 'reseller') utf8_bin

When searching for a record using the search window and using the primary key nr only, the following statement was generated

SELECT * FROM `kunder` WHERE `nr` = 415 AND `kundetype` = 'null'

It should have been

SELECT * FROM `kunder` WHERE `nr` = 415'

Discussion

    • priority: 5 --> 6
    • milestone: --> 3.5.3
     
  • Mike Makowski
    Mike Makowski
    2012-10-12

    This is true of any table with ENUM fields. When searching the table using the Search tab you MUST specify a value for all ENUM fields or you will get no results. You can no longer simply ignore ENUM fields if they aren't needed in your filter expression. I just now noticed this on 3.5.3 but it may have existed earlier.

     
  • It must be a fairly recently introduced bug. I have never had to specify the enum field before. Anyway generating this
    AND `kundetype` = 'null'
    is obviously a bug.

     
    • assigned_to: nobody --> atul5
     
  • The bug was fixed in the repository and will be part of a future release.
    Thanks for reporting.

     
    • priority: 6 --> 1
    • summary: Invalid SELECT statement when enum field present --> (ok 3.5.4) Invalid SELECT statement when enum field present
    • status: open --> open-fixed
     
  • Marc Delisle
    Marc Delisle
    2012-11-16

    • status: open-fixed --> closed-fixed
     
  • Michal Čihař
    Michal Čihař
    2013-06-11

    • Status: closed-fixed --> fixed