Opened 14 years ago

Closed 13 years ago

Last modified 13 years ago

#2974 closed enhancement (fixed)

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

Reported by: Elgon Owned by: kcube
Priority: minor: annoyance Milestone: Version 1.6.0
Component: Build/Install Version:
Keywords: NULL search Cc:
Must Fix for Release: Yes Platform: Debian
Platform Version: Windows 7 Awaiting user input: no

Description

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.

Suggestions:

  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 "=".)

Change History (6)

comment:1 by wonder, 13 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".

in reply to:  1 comment:2 by jef, 13 years ago

Replying to wonder:

I disagree with the second suggestion

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

BTW the string NULL is also the representation for undefined string attributes in the attribute editor. Searching for (or editing to) a literal string "NULL" will(/is) currently impossible - maybe there should be a way to set the NULL representing value in options.

comment:3 by jef, 13 years ago

Owner: changed from nobody to kcube

comment:4 by jef, 13 years ago

Priority: major: does not work as expectedminor: annoyance
Type: bugenhancement

comment:5 by sunilkcube, 13 years ago

Resolution: fixed
Status: newclosed

comment:6 by sunilkcube, 13 years ago

fixed in r15056c by Jurgen

Note: See TracTickets for help on using tickets.