[Tile-serving] [osm2pgsql] Indexes Failed to Create With Large Data Load (Windows) (#494)

alex85k notifications at github.com
Thu Nov 5 15:15:50 UTC 2015


One of the following command seem to fail:
```
        pgsql_exec_simple(sql_conn, PGRES_COMMAND_OK, (fmt("CREATE TABLE %1%_tmp %2% AS SELECT * FROM %1% ORDER BY CASE WHEN ST_IsEmpty(way) THEN NULL ELSE ST_GeoHash(ST_Transform(ST_Envelope(way),4326),10) END") % name % (table_space ? "TABLESPACE " + table_space.get() : "")).str());
        pgsql_exec_simple(sql_conn, PGRES_COMMAND_OK, (fmt("DROP TABLE %1%") % name).str());
        pgsql_exec_simple(sql_conn, PGRES_COMMAND_OK, (fmt("ALTER TABLE %1%_tmp RENAME TO %1%") % name).str());
        // Re-add constraints if on 1.x. 2.0 has typemod, and they automatically come with CREATE TABLE AS
        pgsql_exec_simple(sql_conn, PGRES_TUPLES_OK, (fmt("SELECT CASE WHEN PostGIS_Lib_Version() LIKE '1.%%' THEN Populate_Geometry_Columns('%1%'::regclass) ELSE 1 END;") % name).str());
```

If the base is still in that sate you can try to execute manually
```
CREATE TABLE planet_osm_polygon_tmp AS SELECT * FROM planet_osm_polygon ORDER BY CASE WHEN ST_IsEmpty(way) THEN NULL ELSE ST_GeoHash(ST_Transform(ST_Envelope(way),4326),10) END
DROP TABLE planet_osm_polygon
ALTER TABLE planet_osm_polygon_tmp RENAME TO planet_osm_polygon
SELECT CASE WHEN PostGIS_Lib_Version() LIKE '1.%%' THEN Populate_Geometry_Columns('planet_osm_polygon'::regclass) ELSE 1 END;"
```



---
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/osm2pgsql/issues/494#issuecomment-154089107
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/tile-serving/attachments/20151105/d4540dcd/attachment.html>


More information about the Tile-serving mailing list