Repack testfile.tar.gz without volume label for portability
[gpstools.git] / postgres / Patch / track-id-3.patch
bloba54c8ac2be205979aa955ad0d25405ca65677b00
1 Index: create_funcs.sql
2 ===================================================================
3 --- create_funcs.sql (revision 2830)
4 +++ create_funcs.sql (working copy)
5 @@ -142,9 +142,6 @@
6 curr_id integer;
7 currpoint point;
8 BEGIN
9 - -- FOR curr IN SELECT * FROM wayp_new LOOP
10 - -- NULL;
11 - -- END LOOP;
12 UPDATE wayp_new SET coor = point(
13 round(coor[0]::numeric, 6),
14 round(coor[1]::numeric, 6)
15 @@ -154,22 +151,25 @@
16 IF curr_id IS NOT NULL THEN
17 RAISE NOTICE 'curr_id er ikke null: %', curr_id;
18 currpoint = (SELECT coor FROM wayp_new WHERE id = curr_id);
19 - IF (SELECT coor FROM wayp WHERE coor[0] = currpoint[0] AND coor[1] = currpoint[1]) IS NOT NULL THEN
20 + IF (SELECT coor FROM wayp WHERE coor[0] = currpoint[0] AND coor[1] = currpoint[1] LIMIT 1) IS NOT NULL THEN
21 RAISE NOTICE '% finnes allerede i wayp', currpoint;
22 INSERT INTO wayp_rej SELECT * FROM wayp_new WHERE id = curr_id;
23 ELSE
24 RAISE NOTICE '% er ikke i wayp', currpoint;
25 INSERT INTO wayp SELECT * FROM wayp_new WHERE id = curr_id;
26 - PERFORM update_trackpoint(currpoint);
27 + RAISE NOTICE 'Før UPDATE logg...';
28 + UPDATE logg SET upd = TRUE WHERE upd IS NOT TRUE AND coor <-> currpoint < 0.05;
29 + RAISE NOTICE '...UPDATE logg er ferdig, upd-count = %', (SELECT count(*) FROM logg WHERE upd = TRUE);
30 END IF;
31 DELETE FROM wayp_new WHERE id = curr_id;
32 - -- COPY (SELECT name FROM wayp WHERE coor::varchar = currpoint::varchar)
33 - -- TO STDOUT;
34 ELSE
35 - RAISE NOTICE 'currpoint er null';
36 + RAISE NOTICE 'curr_id er null';
37 EXIT;
38 END IF;
39 END LOOP;
40 + RAISE NOTICE'UPDATE logg med clname og cldist...';
41 + UPDATE logg SET sted = clname(coor), dist = cldist(coor), upd = FALSE WHERE upd = TRUE;
42 + RAISE NOTICE '...ferdig.';
43 END;
44 $$ LANGUAGE plpgsql; -- }}}
46 Index: create_index.sql
47 ===================================================================
48 --- create_index.sql (revision 2830)
49 +++ create_index.sql (working copy)
50 @@ -6,6 +6,7 @@
51 CREATE INDEX log_ele_idx on logg(ele);
52 CREATE INDEX log_sted_idx on logg(sted);
53 CREATE INDEX log_dist_idx on logg(dist);
54 +CREATE INDEX log_upd_idx on logg(upd);
56 -- DROP INDEX begin_idx;
57 -- DROP INDEX end_idx;
58 Index: create_table.sql
59 ===================================================================
60 --- create_table.sql (revision 2830)
61 +++ create_table.sql (working copy)
62 @@ -6,7 +6,9 @@
63 ele numeric,
64 sted text,
65 dist numeric(8, 5),
66 - description text
67 + description text,
68 + upd boolean DEFAULT TRUE,
69 + id serial
72 CREATE TABLE wayp (