[postgis-users] Postgres/PostGIS and date field

Mark Cave-Ayland mark.cave-ayland at siriusit.co.uk
Tue Dec 2 03:16:34 PST 2008


Vincenzo Patruno wrote:

> Hi list!
> 
> In my file .map I wrote something like
> 
> 
> select the_geom .......... (end_date -  now() >= 10) as green and (end_date - now() < 0) as red .... from ....
> 
> 
> 
> The idea is using different coloured markers for expired points  or valid points
> 
> After upgrading Postgres/Gis with last available versions, the query above doesn't work anymore because  I cannot compare date types with integers .......
> Any idea?
> 
> Thanks in advance
> 
> Vinc


Hi Vinc,

This sounds like the casting changes in 8.3 are hitting you here. Have 
you tried something like this:

select the_geom .......... (end_date -  now() >= '10 days'::interval) as 
green and (end_date - now() < '0'::interval) as red .... from ....

I'm not sure exactly what units you were using, but you should be able 
to work with the example above to get what you want.


HTH,

Mark.

-- 
Mark Cave-Ayland
Sirius Corporation - The Open Source Experts
http://www.siriusit.co.uk
T: +44 870 608 0063



More information about the postgis-users mailing list