Feature request #2974

Search for NULL value seemignly not possible from simple search and not obvious from advanced search

Added by Elgon - about 12 years ago. Updated over 11 years ago.

Assignee:kcube -
Pull Request or Patch supplied: Resolution:fixed
Easy fix?:No Copied to github as #:13034


In the release notes for QGIS 1.5.0 it says "Support NULL values in search strings".
However, a search for NULL,"", _,"NULL" in the "Look for" box does not yield any results.
It is possible to search for NULL in advanced search with the syntax Field IS NULL. This however is also not obvious as "IS" does not seem to be an optional operator within the Search Query Builder.

AS the NULL value can occur often in data and can be seen in the attribute table but cannot be searched for in an easy way like all other values, I plead for a an equal treatment of NULL in this respect.

1. Enable the search for NULL in the simple search.
2. Enable search with the syntax "Field = NULL" in the Advanced search. (I believe introducing "IS" as a new operator does not make much sense as it is logically the same as "=".)


#1 Updated by Martin Dobias over 11 years ago

I disagree with the second suggestion: allowing the syntax "Field = NULL" would not be correct. We are trying to keep the functionality as close to SQL standard as possible. SQL uses three-valued logic (true, false, unknown) and all predicates like "x = NULL" return unknown. Select command returns only rows where predicate evaluates to true. Therefore "select * from Table WHERE x = NULL" will always return zero rows. Test for NULL can be done only by using "x IS NULL".

If the user wants to search for NULL rows, we could allow him to enter "NULL" as a search text and generate the query as "x IS NULL".

#2 Updated by Jürgen Fischer over 11 years ago

Replying to [comment:1 wonder]:

I disagree with the second suggestion

Thanks, I would have posted almost exactly the same, you just were a bit quicker ;)

#3 Updated by sunilkcube - over 11 years ago

  • Resolution set to fixed
  • Status changed from Open to Closed

Also available in: Atom PDF