-
-
Notifications
You must be signed in to change notification settings - Fork 276
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#1470 Del proj w/ invalid geometries
- Loading branch information
1 parent
a7ce079
commit 267e9d9
Showing
2 changed files
with
34 additions
and
0 deletions.
There are no files selected for viewing
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
|
||
SELECT | ||
projects.id | ||
INTO TEMPORARY TABLE | ||
project_list | ||
FROM | ||
projects | ||
WHERE ST_XMin(geometry) < -180 | ||
or ST_XMax(geometry) > 180 | ||
or ST_YMin(geometry) < -90 | ||
or ST_YMax(geometry) > 90; | ||
|
||
|
||
CREATE OR REPLACE FUNCTION delete_results() | ||
RETURNS SETOF text AS | ||
$func$ | ||
DECLARE | ||
elem int; | ||
BEGIN | ||
FOR elem IN | ||
SELECT * FROM project_list | ||
LOOP | ||
DELETE FROM public.project_info WHERE project_id = elem; | ||
DELETE FROM public.project_chat WHERE project_id = elem; | ||
DELETE FROM public.task_history WHERE project_id = elem; | ||
DELETE FROM public.task_invalidation_history WHERE project_id = elem; | ||
DELETE FROM public.tasks WHERE project_id = elem; | ||
RETURN NEXT elem; | ||
RAISE NOTICE 'Project: %', elem; | ||
END LOOP; | ||
END | ||
$func$ LANGUAGE plpgsql; | ||
|
||
SELECT * from delete_results() |