【问题标题】:Error in Postgis SQL statement for OSM dataOSM 数据的 Postgis SQL 语句中的错误
【发布时间】:2020-07-28 16:56:00
【问题描述】:

我正在尝试使用连接到 PostGIS 数据库的 QGIS 中的 DB 管理器在 OSM 多边形数据中选择一个特定值。当我输入

SELECT * 
FROM planet_osm_polygon 
WHERE landuse is not null 

此 SQL 语句有效。它给了我所有具有土地利用价值的行。

但是,如果我将 landuse 替换为 natural(这是另一个列名),它会给我一条错误消息。我使用了另一个列名,例如leisure。我得到查询结果。

我不知道为什么我不能使用natural 列标题名称。任何解决此错误的线索将不胜感激。

【问题讨论】:

    标签: postgresql postgis openstreetmap where-clause


    【解决方案1】:

    naturalreserved keyword,所以需要用双引号括起来:

    SELECT * FROM osm_polygons WHERE "natural" is not null;
    

    PS:如果列名中有分号也是如此:

    SELECT * FROM osm_polygons WHERE "addr:housenumber" is not null;
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-09-27
      • 1970-01-01
      • 2016-09-01
      • 2013-11-30
      • 2015-06-19
      • 1970-01-01
      相关资源
      最近更新 更多