diff --git a/js/tbl_select.js b/js/tbl_select.js index f04b4e3553..ec274dc5aa 100644 --- a/js/tbl_select.js +++ b/js/tbl_select.js @@ -42,6 +42,12 @@ $(function() { * (see $GLOBALS['cfg']['AjaxEnable']) */ $("#tbl_search_form.ajax").live('submit', function(event) { + var unaryFunctions = [ + 'IS NULL', + 'IS NOT NULL', + "= ''", + "!= ''"]; + // jQuery object to reuse $search_form = $(this); event.preventDefault(); @@ -64,8 +70,12 @@ $(function() { } }); var columnCount = $('select[name="columnsToDisplay[]"] option').length; - // Submit values only for the columns that have a search criteria + // Submit values only for the columns that have unary column operator or a search criteria for (var a = 0; a < columnCount; a++) { + if ($.inArray(values['criteriaColumnOperators[' + a + ']'], unaryFunctions) >= 0) { + continue; + } + if (values['criteriaValues[' + a + ']'] == '') { delete values['criteriaValues[' + a + ']']; delete values['criteriaColumnOperators[' + a + ']']; diff --git a/libraries/TableSearch.class.php b/libraries/TableSearch.class.php index 7de43e5fd5..4bc802e968 100644 --- a/libraries/TableSearch.class.php +++ b/libraries/TableSearch.class.php @@ -656,8 +656,9 @@ EOT; return $fullWhereClause; } - // If there are no search criteria set, return - if (! array_filter($_POST['criteriaValues'])) { + // If there are no search criteria set or no unary criteria operators, return + if (! array_filter($_POST['criteriaValues']) + && ! array_intersect($_POST['criteriaColumnOperators'], $GLOBALS['PMA_Types']->getUnaryOperators())) { return $fullWhereClause; }