9

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:city 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?

mu is too short
  • 426,620
  • 70
  • 833
  • 800
Vorleak Chy
  • 649
  • 9
  • 13

1 Answers1

14

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.

Wouter van Nifterick
  • 23,603
  • 7
  • 78
  • 122