Am 13.05.2010 16:30, schrieb Colin Marquardt:
> The SQL from that file is
> <Parameter name="table"> (SELECT
> tags->'lit' AS lit, way FROM planet_polygon WHERE (tags ? 'lit')
> AND (tags->'lit' IN ('yes', 'no'))) AS areas</Parameter>
>
> So I suppose I need to select * in some way? (I know next to no SQL.)
no, never select *. if you need 'building', just select tags->'building'
AS building:
SELECT tags->'lit' AS lit,
tags->'building' AS building,
way
FROM planet_polygon
WHERE (tags ? 'lit') AND
(tags->'lit' IN ('yes', 'no'))
> But even if this example can be made to work, in general this will
> only work as long as whatever I filter on is not in hstore.
No that is no problem, I think. From the sql-clients point of view,
SELECT foo FROM .. just the same as
SELECT tags->bla AS foo FROM ..
The AS construct makes it transparent for the client if the tag comes
from the hstore or from a normal column. This is why you can just write
<Filter>[lit] = 'yes'</Filter>, no matter where 'lit' comes from.
>> You can get all tags from the hstore and just don't use the classic
>> columns if you don't want to.
>
> This probably comes with a speed penalty, right?
There is no penalty for fetching data from the hstore. There is a small
penalty when using the hstore in the where clause but this highly
depends on the usage of the tag.
Peter
_______________________________________________
Maps-l mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/maps-l