-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathsicob_add_geoinfo_column.sql
More file actions
44 lines (39 loc) · 1.4 KB
/
Copy pathsicob_add_geoinfo_column.sql
File metadata and controls
44 lines (39 loc) · 1.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
SET CLIENT_ENCODING TO 'utf8';
CREATE OR REPLACE FUNCTION public.sicob_add_geoinfo_column(table_name text)
RETURNS void
LANGUAGE plpgsql
AS $function$
DECLARE
sql TEXT;
BEGIN
--ADICIONA CAMPOS DE INFORMACION GEOGRAFICA
-------------------------------------------
IF SICOB_exist_column(table_name, 'sicob_sup') = FALSE THEN
sql := Format('ALTER TABLE %s ADD COLUMN sicob_sup double precision', table_name);
EXECUTE sql;
END IF;
IF SICOB_exist_column(table_name, 'sicob_utm') = FALSE THEN
sql := Format('ALTER TABLE %s ADD COLUMN sicob_utm int', table_name);
EXECUTE sql;
END IF;
IF SICOB_exist_column(table_name, 'the_geom_webmercator') = FALSE THEN
sql := Format('ALTER TABLE %s ADD COLUMN the_geom_webmercator geometry(Geometry,3857)', table_name);
EXECUTE sql;
END IF;
/*
IF SICOB_exist_column(table_name, 'the_geom_webmercator') THEN
sql := Format('ALTER TABLE %s DROP COLUMN the_geom_webmercator', table_name);
EXECUTE sql;
END IF;
sql := Format('ALTER TABLE %s ADD COLUMN the_geom_webmercator geometry(Geometry,3857)', table_name);
EXECUTE sql;
IF SICOB_exist_column(table_name, 'sicob_sup') THEN
sql := Format('ALTER TABLE %s DROP COLUMN sicob_sup', table_name);
EXECUTE sql;
END IF;
sql := Format('ALTER TABLE %s ADD COLUMN sicob_sup double precision', table_name);
EXECUTE sql;
*/
END;
$function$