gpst: %Cmd: Remove it, unused
[gpstools.git] / postgres / Patch / track-id-2.patch
blob8ea1e124848492268e84ada8c3f3de8876b246bd
1 Index: create_funcs.sql
2 ===================================================================
3 --- create_funcs.sql (revision 2829)
4 +++ create_funcs.sql (working copy)
5 @@ -149,27 +149,39 @@
6 round(coor[0]::numeric, 6),
7 round(coor[1]::numeric, 6)
8 );
9 + CREATE TEMPORARY TABLE tmp
10 + ON COMMIT DROP
11 + AS SELECT * from logg LIMIT 0;
12 LOOP
13 curr_id = first_wayp_new();
14 IF curr_id IS NOT NULL THEN
15 RAISE NOTICE 'curr_id er ikke null: %', curr_id;
16 currpoint = (SELECT coor FROM wayp_new WHERE id = curr_id);
17 - IF (SELECT coor FROM wayp WHERE coor[0] = currpoint[0] AND coor[1] = currpoint[1]) IS NOT NULL THEN
18 + IF (SELECT coor FROM wayp WHERE coor[0] = currpoint[0] AND coor[1] = currpoint[1] LIMIT 1) IS NOT NULL THEN
19 RAISE NOTICE '% finnes allerede i wayp', currpoint;
20 INSERT INTO wayp_rej SELECT * FROM wayp_new WHERE id = curr_id;
21 ELSE
22 RAISE NOTICE '% er ikke i wayp', currpoint;
23 INSERT INTO wayp SELECT * FROM wayp_new WHERE id = curr_id;
24 - PERFORM update_trackpoint(currpoint);
25 + RAISE NOTICE 'Før INSERT INTO tmp...';
26 + INSERT INTO tmp SELECT * FROM logg WHERE coor <-> currpoint < 0.05;
27 + RAISE NOTICE 'DELETE FROM logg...';
28 + DELETE FROM logg WHERE coor <-> currpoint < 0.05;
29 + RAISE NOTICE '...DELETE FROM logg er ferdig, count i tmp = %', (select count(*) from tmp);
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 tmp...';
41 + UPDATE tmp SET sted = clname(coor), dist = cldist(coor);
42 + RAISE NOTICE 'INSERT INTO logg...';
43 + INSERT INTO logg SELECT * FROM tmp;
44 + RAISE NOTICE '...ferdig.';
45 END;
46 $$ LANGUAGE plpgsql; -- }}}
48 Index: create_table.sql
49 ===================================================================
50 --- create_table.sql (revision 2829)
51 +++ create_table.sql (working copy)
52 @@ -6,7 +6,8 @@
53 ele numeric,
54 sted text,
55 dist numeric(8, 5),
56 - description text
57 + description text,
58 + id serial
61 CREATE TABLE wayp (