开发者

Problem with a column name contains a colon in PostgreSQL

开发者 https://www.devze.com 2023-02-09 16:06 出处:网络
I downloaded the shape data from OSM. I have imported data from Shapefile into PostgreSQL without any problem but I got an error when I do the select statement.

I downloaded the shape data from OSM. I have imported data from Shapefile into PostgreSQL without any problem but I got an error when I do the select statement.

Select addr:c开发者_如何学Pythonity From location;

Error: syntax error at or near ":"

The problem is because of the column name contains a colon. Could anyone help me with this issue? Should I reject this shapefile in the importing process? Is the shapefile normal?


If you enclose addr:city with quotes it should work:

SELECT "addr:city" FROM "location";

And if you want to use OpenStreetMap data, you don't have to import shapefiles. Instead, you can import planet.osm (or a regional subset) directly with osm2pgsql.

0

精彩评论

暂无评论...
验证码 换一张
取 消