1 Index: create_funcs.sql
2 ===================================================================
3 --- create_funcs.sql (revision 2830)
4 +++ create_funcs.sql (working copy)
9 - -- FOR curr IN SELECT * FROM wayp_new LOOP
12 UPDATE wayp_new SET coor = point(
13 round(coor[0]::numeric, 6),
14 round(coor[1]::numeric, 6)
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;
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);
31 DELETE FROM wayp_new WHERE id = curr_id;
32 - -- COPY (SELECT name FROM wayp WHERE coor::varchar = currpoint::varchar)
35 - RAISE NOTICE 'currpoint er null';
36 + RAISE NOTICE 'curr_id er null';
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.';
44 $$ LANGUAGE plpgsql; -- }}}
46 Index: create_index.sql
47 ===================================================================
48 --- create_index.sql (revision 2830)
49 +++ create_index.sql (working copy)
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)
68 + upd boolean DEFAULT TRUE,