2 -- File ID: 4765dc0a-fafb-11dd-874c-000475e441b9
4 -- Round waypoints to six decimal digits -- {{{
6 \echo ================ Round waypoints to six decimal digits ================
8 UPDATE wayp SET coor = point(
9 round(coor[0]::numeric, 6),
10 round(coor[1]::numeric, 6)
13 -- Remove duplicates from wayp -- {{{
15 \echo ================ Remove duplicates from wayp ================
17 COPY (SELECT '======== Number of waypoints in wayp before cleanup: ' || count(*) from wayp) to STDOUT;
19 BEGIN ISOLATION LEVEL SERIALIZABLE;
20 CREATE TEMPORARY TABLE dupfri
45 COPY (SELECT '======== Number of waypoints in wayp after cleanup: ' || count(*) from wayp) to STDOUT;
48 -- Remove duplicates from events -- {{{
50 \echo ================ Remove duplicates from events ================
52 COPY (SELECT '======== Event count before cleanup: ' || count(*) from events) to STDOUT;
54 BEGIN ISOLATION LEVEL SERIALIZABLE;
55 CREATE TEMPORARY TABLE dupfri
59 DISTINCT ON (date, coor[0], coor[1], descr) *
70 COPY (SELECT '======== Event count after cleanup: ' || count(*) from events) to STDOUT;
73 -- Update picture coordinates -- {{{
75 \echo ================ Update picture coordinates ================
77 UPDATE pictures SET coor = findpos(date)
80 -- Round picture coordinates -- {{{
81 \echo ================ Round picture coordinates ================
82 UPDATE pictures SET coor = point(
83 round(coor[0]::numeric, 6),
84 round(coor[1]::numeric, 6)
87 -- Remove duplicates from pictures -- {{{
89 \echo ================ Remove duplicates from pictures ================
91 COPY (SELECT '======== Picture count before cleanup: ' || count(*) from pictures) to STDOUT;
93 BEGIN ISOLATION LEVEL SERIALIZABLE;
94 CREATE TEMPORARY TABLE dupfri
98 DISTINCT ON (date, coor[0], coor[1], descr, filename, author) *
102 INSERT INTO pictures (
109 COPY (SELECT '======== Picture count after cleanup: ' || count(*) from pictures) to STDOUT;
112 -- Update coordinates for films -- {{{
114 \echo ================ Update coordinates for films ================
116 UPDATE film SET coor = findpos(date)
119 -- Round film coordinates -- {{{
120 \echo ================ Round film coordinates ================
121 UPDATE film SET coor = point(
122 round(coor[0]::numeric, 6),
123 round(coor[1]::numeric, 6)
126 -- Remove duplicates from film -- {{{
128 \echo ================ Remove duplicates from film ================
130 COPY (SELECT '======== Film count before cleanup: ' || count(*) from film) to STDOUT;
132 BEGIN ISOLATION LEVEL SERIALIZABLE;
133 CREATE TEMPORARY TABLE dupfri
137 DISTINCT ON (date, coor[0], coor[1], descr, filename, author) *
148 COPY (SELECT '======== Film count after cleanup: ' || count(*) from film) to STDOUT;
151 -- Oppdater koordinater for lyd -- {{{
153 \echo ================ Update sound coordinates ================
155 UPDATE lyd SET coor = findpos(date)
158 -- Update sound coordinates -- {{{
159 \echo ================ Update sound coordinates ================
160 UPDATE lyd SET coor = point(
161 round(coor[0]::numeric, 6),
162 round(coor[1]::numeric, 6)
165 -- Remove duplicates from sound -- {{{
167 \echo ================ Remove duplicates from sound ================
169 COPY (SELECT '======== Sound count before cleanup: ' || count(*) from lyd) to STDOUT;
171 BEGIN ISOLATION LEVEL SERIALIZABLE;
172 CREATE TEMPORARY TABLE dupfri
176 DISTINCT ON (date, coor[0], coor[1], descr, filename, author) *
187 COPY (SELECT '======== Sound count after cleanup: ' || count(*) from lyd) to STDOUT;