--- insert creates the location tables, creates location indexes if indexed == true
-CREATE TRIGGER placex_before_insert BEFORE INSERT ON placex
- FOR EACH ROW EXECUTE PROCEDURE placex_insert();
-
--- update insert creates the location tables
-CREATE TRIGGER placex_before_update BEFORE UPDATE ON placex
- FOR EACH ROW EXECUTE PROCEDURE placex_update();
-CREATE TRIGGER osmline_before_update BEFORE UPDATE ON location_property_osmline
- FOR EACH ROW EXECUTE PROCEDURE osmline_update();
-
--- diff update triggers
-CREATE TRIGGER placex_before_delete AFTER DELETE ON placex
- FOR EACH ROW EXECUTE PROCEDURE placex_delete();
-CREATE TRIGGER place_before_delete BEFORE DELETE ON place
- FOR EACH ROW EXECUTE PROCEDURE place_delete();
-CREATE TRIGGER place_before_insert BEFORE INSERT ON place
- FOR EACH ROW EXECUTE PROCEDURE place_insert();
-
-DROP SEQUENCE seq_postcodes;
-CREATE SEQUENCE seq_postcodes start 1;
+-- Table for synthetic postcodes.
+DROP TABLE IF EXISTS location_postcode;
+CREATE TABLE location_postcode (
+ place_id BIGINT,
+ parent_place_id BIGINT,
+ rank_search SMALLINT,
+ rank_address SMALLINT,
+ indexed_status SMALLINT,
+ indexed_date TIMESTAMP,
+ country_code varchar(2),
+ postcode TEXT,
+ geometry GEOMETRY(Geometry, 4326)
+ );
+CREATE INDEX idx_postcode_geometry ON location_postcode USING GIST (geometry) {ts:address-index};
+GRANT SELECT ON location_postcode TO "{www-user}" ;