[Mapserver-users] null values in postgis

Vladimir Guzmán bigfoot at main-task.com
Wed Jul 28 05:36:02 PDT 2004


Kathi:
I think it must be something like:
DATA "the_geom FROM (SELECT the_geom, oid, CASE WHEN ha_dk IS NULL THEN 
'' ELSE CAST (ha_dk AS VARCHAR) END AS ha_dk FROM xyz) as foo using 
unique oid using srid=1"

You should run the inside query (SELECT the_geom, oid, CASE WHEN ha_dk 
IS NULL THEN '' ELSE CAST (ha_dk AS VARCHAR) END AS ha_dk FROM xyz) in 
the pgsql console first, and see if the query is correct.

Hope that helps,

-- 
Vladimir Ilich Guzmán R.
------------------------
http://maintask.com 


Kathi Koebke wrote:

> Hey Vladimir,
>
> sorry that I'm  so late  with my answer, but here is my sql-statement. 
> The result is an empty map in mapserver.
> Maybe there' s something wrong in the sql-code or mapserver can't work 
> with NULL values?  I don't know?
>
> DATA "the_geom FROM xyz (SELECT ha_dk CASE WHEN ha_dk IS NULL THEN '' 
> ELSE CAST(ha_dk AS VARCHAR) END AS ha_dk)"
>
> EXPRESSION ([ha_dk] = '')
>
> Tschüß Kathi
>           
> Vladimir Guzmán schrieb:
>
>> I've had a simmilar problem, but with oracle, and what I did was a 
>> casting, for example:
>>
>> data=the_geom FROM (SELECT CASE WHEN field IS NULL THEN ' ' ELSE 
>> CAST(field AS VARCHAR) END AS field)
>>
>> And the expression would be:
>> EXPRESSION ([field] = ' ')
>>
>> I don't know if there is a better way to do that, but it worked.
>>
>> Hope that helps,
>>
>




More information about the MapServer-users mailing list