[Qgis-user] Query expression bugs with NULL Values

José Carlos Martínez Llario jomarlla at cgf.upv.es
Thu Mar 26 02:19:10 PDT 2015


Sorry I didnt explain well. Forget about the second part of the email, I 
was talking about syntax, of course  is well-known that NULL and 'NULL' 
are two different things but that was not my point):

So this this the problem that I would like an answer:

The table has 4635 rows, which 4587 are null as the following queries prove:

  "amenity" is not NULL  returns 48 rows
  "amenity" is NULL returns  4587 rows


The following queries doest not make sense:

"amenity"  <>  'restaurant' returns 37 rows
"amenity"  =  'restaurant'  returns 11 rows

The layers has 48 NULL values, so it means that amenity"  <> 
'restaurant' does not take into account the null values.
Hope this is a bug and not the correct behaviour.

Im using QGIS 2.8.1





The table has 48 null "amenity" rows and 4587 not null "amenity" rows as 
you can see from the first queries

On 25/03/2015 20:38, Andre Joost wrote:
> Am 25.03.2015 um 20:07 schrieb José Carlos Martínez Llario:
>
>>
>>
>> The layers has 48 NULL values,
>
>
> ...
>
>> THIS IS OK
>> "amenity" is not NULL returns 48
>> "amenity" is NULL returns  4587
>>
>
> This does not make nuch sense to me. Do you have 48 empty (NULL) 
> entries, or 48 non-empty values?
>
>> THIS IS WRONG (if null values can not be treated as a text in the syntax
>> it shouldnt work in both cases or throw some error)
>> "amenity" <> 'NULL' returns 48
>> "amenity"  =  'NULL'  returns 0   ????
>
> No, NULL and 'NULL' are two different things. It is possible to write 
> 'NULL' as a text value for amenity (although it does not make sense, 
> but the OSM database does not reject it).
>
> So it should be ok that "amenity"  =  'NULL' returns nothing in your 
> dataset.
>
> HTH,
> André Joost
>
>
> _______________________________________________
> Qgis-user mailing list
> Qgis-user at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/qgis-user

-- 
------------------------------
José Carlos Martínez Llario
http://cartosig.upv.es

Producción Cartográfica y SIG.
Dpto. Ingeniería Cartográfica.
Univ. Politécnica de Valencia.
------------------------------




More information about the Qgis-user mailing list