On Wed, Mar 3, 2010 at 01:21, Brett Henderson <[email protected]> wrote:
> Hi Ævar,
>
> Can you provide the full error output from Osmosis. I suspect there's a
> "caused by" nested exception that provides the root cause for the error.
After some more debugging it turns out that the issue is simply that
the script/*.sql files are very out of date and in no way reflect the
current DB schema or the tables that osmosis tries to insert into.
In the attached patch I fixed some of these but it doesn't fix all the
issues, the current_* tables are still missing. It would be nice if
one could skip importing into current_* for one-off imports like
these.
> As for SQLite support, it's a nice idea but a non-trivial amount of work.
> I'm happy to give somebody guidance on adding it, but I don't have time
> myself.
Ok :)
Index: script/pgsql_simple_schema_0.6.sql
===================================================================
--- script/pgsql_simple_schema_0.6.sql (revision 20253)
+++ script/pgsql_simple_schema_0.6.sql (working copy)
@@ -3,6 +3,8 @@
-- Drop all tables if they exist.
DROP TABLE IF EXISTS actions;
DROP TABLE IF EXISTS users;
+DROP TABLE IF EXISTS changesets;
+DROP TABLE IF EXISTS changeset_tags;
DROP TABLE IF EXISTS nodes;
DROP TABLE IF EXISTS node_tags;
DROP TABLE IF EXISTS ways;
@@ -16,6 +18,12 @@
-- Drop all stored procedures if they exist.
DROP FUNCTION IF EXISTS osmosisUpdate();
+-- Create enum
+CREATE TYPE nwr_enum AS ENUM (
+ 'Node',
+ 'Way',
+ 'Relation'
+);
-- Create a table which will contain a single row defining the current schema version.
CREATE TABLE schema_info (
@@ -25,18 +33,57 @@
-- Create a table for users.
CREATE TABLE users (
- id int NOT NULL,
- name text NOT NULL
+ email character varying(255) NOT NULL,
+ id bigint NOT NULL,
+ active integer DEFAULT 0 NOT NULL,
+ pass_crypt character varying(255) NOT NULL,
+ creation_time timestamp without time zone NOT NULL,
+ display_name character varying(255) DEFAULT ''::character varying NOT NULL,
+ data_public boolean DEFAULT false NOT NULL,
+ description text DEFAULT ''::text NOT NULL,
+ home_lat double precision,
+ home_lon double precision,
+ home_zoom smallint DEFAULT 3,
+ nearby integer DEFAULT 50,
+ pass_salt character varying(255),
+ image text,
+ email_valid boolean DEFAULT false NOT NULL,
+ new_email character varying(255),
+ visible boolean DEFAULT true NOT NULL,
+ creation_ip character varying(255),
+ languages character varying(255)
);
+-- Create a table for changesets,
+CREATE TABLE changesets (
+ id bigint NOT NULL,
+ user_id bigint NOT NULL,
+ created_at timestamp without time zone NOT NULL,
+ min_lat integer,
+ max_lat integer,
+ min_lon integer,
+ max_lon integer,
+ closed_at timestamp without time zone NOT NULL,
+ num_changes integer DEFAULT 0 NOT NULL
+);
+-- Create a table for changeset tags.
+CREATE TABLE changeset_tags (
+ id bigint NOT NULL,
+ k character varying(255) DEFAULT ''::character varying NOT NULL,
+ v character varying(255) DEFAULT ''::character varying NOT NULL
+);
+
-- Create a table for nodes.
CREATE TABLE nodes (
id bigint NOT NULL,
- version int NOT NULL,
- user_id int NOT NULL,
- tstamp timestamp without time zone NOT NULL,
- changeset_id bigint NOT NULL
+ latitude integer NOT NULL,
+ longitude integer NOT NULL,
+ changeset_id bigint NOT NULL,
+ visible boolean NOT NULL,
+ "timestamp" timestamp without time zone NOT NULL,
+ tile bigint NOT NULL,
+ version bigint NOT NULL
);
-- Add a postgis point column holding the location of the node.
SELECT AddGeometryColumn('nodes', 'geom', 4326, 'POINT', 2);
@@ -44,65 +91,67 @@
-- Create a table for node tags.
CREATE TABLE node_tags (
- node_id bigint NOT NULL,
- k text NOT NULL,
- v text NOT NULL
+ id bigint NOT NULL,
+ version bigint NOT NULL,
+ k character varying(255) DEFAULT ''::character varying NOT NULL,
+ v character varying(255) DEFAULT ''::character varying NOT NULL
);
-
-- Create a table for ways.
CREATE TABLE ways (
- id bigint NOT NULL,
- version int NOT NULL,
- user_id int NOT NULL,
- tstamp timestamp without time zone NOT NULL,
- changeset_id bigint NOT NULL
+ id bigint DEFAULT 0 NOT NULL,
+ changeset_id bigint NOT NULL,
+ "timestamp" timestamp without time zone NOT NULL,
+ version bigint NOT NULL,
+ visible boolean DEFAULT true NOT NULL
);
-- Create a table for representing way to node relationships.
CREATE TABLE way_nodes (
- way_id bigint NOT NULL,
+ id bigint NOT NULL,
node_id bigint NOT NULL,
- sequence_id int NOT NULL
+ version bigint NOT NULL,
+ sequence_id bigint NOT NULL
);
-- Create a table for way tags.
CREATE TABLE way_tags (
- way_id bigint NOT NULL,
- k text NOT NULL,
- v text
+ id bigint DEFAULT 0 NOT NULL,
+ k character varying(255) NOT NULL,
+ v character varying(255) NOT NULL,
+ version bigint NOT NULL
);
-
-- Create a table for relations.
CREATE TABLE relations (
- id bigint NOT NULL,
- version int NOT NULL,
- user_id int NOT NULL,
- tstamp timestamp without time zone NOT NULL,
- changeset_id bigint NOT NULL
+ id bigint DEFAULT 0 NOT NULL,
+ changeset_id bigint NOT NULL,
+ "timestamp" timestamp without time zone NOT NULL,
+ version bigint NOT NULL,
+ visible boolean DEFAULT true NOT NULL
);
-- Create a table for representing relation member relationships.
CREATE TABLE relation_members (
- relation_id bigint NOT NULL,
+ id bigint DEFAULT 0 NOT NULL,
+ member_type nwr_enum NOT NULL,
member_id bigint NOT NULL,
- member_type character(1) NOT NULL,
- member_role text NOT NULL,
- sequence_id int NOT NULL
+ member_role character varying(255) NOT NULL,
+ version bigint DEFAULT 0 NOT NULL,
+ sequence_id integer DEFAULT 0 NOT NULL
);
-- Create a table for relation tags.
CREATE TABLE relation_tags (
- relation_id bigint NOT NULL,
- k text NOT NULL,
- v text NOT NULL
+ id bigint DEFAULT 0 NOT NULL,
+ k character varying(255) DEFAULT ''::character varying NOT NULL,
+ v character varying(255) DEFAULT ''::character varying NOT NULL,
+ version bigint NOT NULL
);
-
-- Configure the schema version.
INSERT INTO schema_info (version) VALUES (4);
_______________________________________________
dev mailing list
[email protected]
http://lists.openstreetmap.org/listinfo/dev