From bdec4e648823bf33dd3f898b6c202d6d9f1251e3 Mon Sep 17 00:00:00 2001 From: Sarah Hoffmann Date: Thu, 29 Jun 2017 23:34:09 +0200 Subject: [PATCH] replace AddGeometryColumn() functions Directly add the columns to the table definitions instead. --- sql/partition-tables.src.sql | 8 ++++---- sql/tables.sql | 24 ++++++++++++------------ 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/sql/partition-tables.src.sql b/sql/partition-tables.src.sql index 6f799bcf..eb2ed77b 100644 --- a/sql/partition-tables.src.sql +++ b/sql/partition-tables.src.sql @@ -29,9 +29,9 @@ CREATE TABLE search_name_blank ( place_id BIGINT, search_rank smallint, address_rank smallint, - name_vector integer[] + name_vector integer[], + centroid GEOMETRY(Geometry, 4326) ); -SELECT AddGeometryColumn('search_name_blank', 'centroid', 4326, 'GEOMETRY', 2); CREATE TABLE location_area_country () INHERITS (location_area_large) {ts:address-data}; @@ -54,9 +54,9 @@ CREATE INDEX idx_search_name_-partition-_name_vector ON search_name_-partition- CREATE TABLE location_road_-partition- ( place_id BIGINT, partition SMALLINT, - country_code VARCHAR(2) + country_code VARCHAR(2), + geometry GEOMETRY(Geometry, 4326) ) {ts:address-data}; -SELECT AddGeometryColumn('location_road_-partition-', 'geometry', 4326, 'GEOMETRY', 2); CREATE INDEX idx_location_road_-partition-_geometry ON location_road_-partition- USING GIST (geometry) {ts:address-index}; CREATE INDEX idx_location_road_-partition-_place_id ON location_road_-partition- USING BTREE (place_id) {ts:address-index}; diff --git a/sql/tables.sql b/sql/tables.sql index 334fcbc0..8d8ba9a7 100644 --- a/sql/tables.sql +++ b/sql/tables.sql @@ -61,10 +61,10 @@ CREATE TABLE location_area ( rank_search SMALLINT NOT NULL, rank_address SMALLINT NOT NULL, country_code VARCHAR(2), - isguess BOOL + isguess BOOL, + centroid GEOMETRY(Point, 4326), + geometry GEOMETRY(Geometry, 4326) ); -SELECT AddGeometryColumn('location_area', 'centroid', 4326, 'POINT', 2); -SELECT AddGeometryColumn('location_area', 'geometry', 4326, 'GEOMETRY', 2); CREATE TABLE location_area_large () INHERITS (location_area); @@ -74,9 +74,9 @@ CREATE TABLE location_property ( parent_place_id BIGINT, partition SMALLINT, housenumber TEXT, - postcode TEXT + postcode TEXT, + centroid GEOMETRY(Point, 4326) ); -SELECT AddGeometryColumn('location_property', 'centroid', 4326, 'POINT', 2); CREATE TABLE location_property_aux () INHERITS (location_property); CREATE INDEX idx_location_property_aux_place_id ON location_property_aux USING BTREE (place_id); @@ -125,9 +125,9 @@ CREATE TABLE search_name ( address_rank SMALLINT, name_vector integer[], nameaddress_vector integer[], - country_code varchar(2) + country_code varchar(2), + centroid GEOMETRY(Geometry, 4326) ) {ts:search-data}; -SELECT AddGeometryColumn('search_name', 'centroid', 4326, 'GEOMETRY', 2); CREATE INDEX idx_search_name_place_id ON search_name USING BTREE (place_id) {ts:search-index}; drop table IF EXISTS place_addressline; @@ -157,9 +157,9 @@ CREATE TABLE placex ( wikipedia TEXT, -- calculated wikipedia article name (language:title) country_code varchar(2), housenumber TEXT, - postcode TEXT + postcode TEXT, + centroid GEOMETRY(Geometry, 4326) ) {ts:search-data}; -SELECT AddGeometryColumn('placex', 'centroid', 4326, 'GEOMETRY', 2); CREATE UNIQUE INDEX idx_place_id ON placex USING BTREE (place_id) {ts:search-index}; CREATE INDEX idx_placex_osmid ON placex USING BTREE (osm_type, osm_id) {ts:search-index}; CREATE INDEX idx_placex_linked_place_id ON placex USING BTREE (linked_place_id) {ts:address-index} WHERE linked_place_id IS NOT NULL; @@ -224,10 +224,10 @@ CREATE TABLE import_polygon_error ( name HSTORE, country_code varchar(2), updated timestamp, - errormessage text + errormessage text, + prevgeometry GEOMTRY(Geometry, 4326), + newgeometry GEOMTRY(Geometry, 4326) ); -SELECT AddGeometryColumn('import_polygon_error', 'prevgeometry', 4326, 'GEOMETRY', 2); -SELECT AddGeometryColumn('import_polygon_error', 'newgeometry', 4326, 'GEOMETRY', 2); CREATE INDEX idx_import_polygon_error_osmid ON import_polygon_error USING BTREE (osm_type, osm_id); GRANT SELECT ON import_polygon_error TO "{www-user}"; -- 2.39.5