Phpmyadmin: Enum โ€˜0โ€™ produces incorrect search SQL

Created on 26 Sep 2018  ยท  3Comments  ยท  Source: phpmyadmin/phpmyadmin

Describe the bug

When an ENUM field contains the value '0' this produces in invalid search term SQL which will not find any rows.

To Reproduce

CREATE TABLE `1_test` (
 `foo` enum('0','1') COLLATE utf8_unicode_ci NOT NULL,
 PRIMARY KEY (`foo`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

INSERT INTO `1_test` (`foo`) VALUES ('0'), ('1');

From search tab:
Select โ€œ0โ€ from dropdown for field foo > Go > === 0 results (incorrect)
Select โ€œ1โ€ from dropdown for field foo > Go > === 1 result (correct)

The generated SQL for โ€˜0โ€™ is producing foo = 0 whereas for โ€˜1โ€™ it is foo = โ€˜1โ€™

Expected behavior

All values used to search an ENUM in the SQL should be inside quotes.

Server configuration

  • Database version: 10.2.15-MariaDB
  • phpMyAdmin version: 4.8.2
bug has-pr

Most helpful comment

I think I have found the part which causes the problem, I'm setting up a pull request.

All 3 comments

Affects master and QA_4_8

I think I have found the part which causes the problem, I'm setting up a pull request.

Here is my pull request: #14648

Was this page helpful?
0 / 5 - 0 ratings

Related issues

barkermn01 picture barkermn01  ยท  3Comments

mauriciofauth picture mauriciofauth  ยท  3Comments

patsib picture patsib  ยท  3Comments

ChrisHSandN picture ChrisHSandN  ยท  3Comments

marcomarsala picture marcomarsala  ยท  3Comments