[Qgis-developer] shapefiles: [field]= 'NULL' selects records with [field]= 0

Lauri Kajan lauri.kajan at gmail.com
Tue Oct 25 04:52:09 EDT 2011


On Mon, Oct 24, 2011 at 6:46 PM, Martin Dobias <wonder.sk at gmail.com> wrote:
> On Mon, Oct 24, 2011 at 12:34 PM, Giovanni Manghi
> <giovanni.manghi at gmail.com> wrote:
>> Hi all,
>>
>> in a shapefile is I try to select all the records with a NULL value
>>
>> [field]= 'NULL'
>>
>> QGIS select instead the ones with value = 0.
>>
>> Is this expected?
>
> Giovanni,
>
> the NULL value is a special one - in your example above you are
> actually searching for string 'NULL'. The correct expression would be:
> myfield IS NULL
>
> btw. In current development version (i.e. post 1.7) there is improved
> support for NULL values and generally three-value logic
> (true/false/unknown) as used in SQL. So some expressions that involve
> null values may give different outcomes.
>
> Regards
> Martin
> _______________________________________________
> Qgis-developer mailing list
> Qgis-developer at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/qgis-developer
>

Hello Giovanni,

I'm also a bit confused.
I tested your problem but couldn't reproduce that at least with 1.7.1.

But what I found out is that there is some weirdness in handling NULL
values in shapefiles in QGIS and OGR.
I send other post to the list concerning that.


-Lauri Kajan


More information about the Qgis-developer mailing list