Skip to content

Commit

Permalink
fix(ci, ud): check_data related fct minor bugfixes
Browse files Browse the repository at this point in the history
  • Loading branch information
danimarinBG committed Jan 21, 2025
1 parent 1ed3424 commit 65d157b
Show file tree
Hide file tree
Showing 9 changed files with 203 additions and 64 deletions.
11 changes: 6 additions & 5 deletions ud/fct/ud_gw_fct_pg2epa_main.sql
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ BEGIN
IF v_count = 0 THEN
RETURN ('{"status":"Failed","message":{"level":1, "text":"There is no sector selected. Please select at least one"}}')::json;
END IF;

-- drop temp tables
DROP TABLE IF EXISTS temp_t_arc_flowregulator;
DROP TABLE IF EXISTS temp_t_lid_usage;
Expand All @@ -102,6 +102,7 @@ BEGIN
DROP TABLE IF EXISTS temp_anl_arc;
DROP TABLE IF EXISTS temp_anl_node;
DROP TABLE IF EXISTS temp_anl_gully;
DROP TABLE IF EXISTS temp_anl_polygon;
DROP TABLE IF EXISTS temp_rpt_inp_raingage;
DROP TABLE IF EXISTS temp_rpt_inp_node;
DROP TABLE IF EXISTS temp_rpt_inp_arc;
Expand Down Expand Up @@ -220,7 +221,7 @@ BEGIN
ELSIF v_step=6 THEN

PERFORM gw_fct_pg2epa_check_result(v_input);

-- deleting arcs without nodes
UPDATE temp_t_arc t SET epa_type = 'TODELETE' FROM (SELECT a.id FROM temp_t_arc a LEFT JOIN temp_t_node ON node_1=node_id WHERE temp_t_node.node_id is null) a WHERE t.id = a.id;
UPDATE temp_t_arc t SET epa_type = 'TODELETE' FROM (SELECT a.id FROM temp_t_arc a LEFT JOIN temp_t_node ON node_2=node_id WHERE temp_t_node.node_id is null) a WHERE t.id = a.id;
Expand All @@ -233,9 +234,9 @@ BEGIN
(SELECT id FROM temp_t_node LEFT JOIN (SELECT node_1 as node_id FROM temp_t_arc UNION SELECT node_2 FROM temp_t_arc) a USING (node_id) WHERE a.node_id IS NULL) a
WHERE t.id = a.id;
DELETE FROM temp_t_node WHERE epa_type = 'TODELETE';

-- create return
EXECUTE 'SELECT gw_fct_create_return($${"data":{"parameters":{"functionId":2646, "isEmbebed":false}}}$$::json)' INTO v_return;
EXECUTE 'SELECT gw_fct_create_return($${"data":{"parameters":{"functionId":2646, "isEmbebed":false}}}$$::json)' INTO v_return;
SELECT gw_fct_pg2epa_export_inp(p_data) INTO v_file;
v_body = gw_fct_json_object_set_key((v_return->>'body')::json, 'file', v_file);
v_return = gw_fct_json_object_set_key(v_return, 'body', v_body);
Expand All @@ -261,7 +262,7 @@ BEGIN
SELECT result_id, node_id, top_elev, ymax, elev, node_type, nodecat_id, epa_type,
sector_id, state, state_type, annotation, y0, ysur, apond, the_geom, expl_id, addparam, parent, arcposition, fusioned_node
FROM temp_t_node;

-- move result data
UPDATE rpt_cat_result r set network_stats = t.network_stats FROM temp_t_rpt_cat_result t WHERE r.result_id = t.result_id;

Expand Down
116 changes: 110 additions & 6 deletions updates/40/40000/ud/ddl.sql
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@ ALTER TABLE config_form_fields ENABLE TRIGGER gw_trg_config_control;
ALTER TABLE sys_feature_type DROP CONSTRAINT sys_feature_type_check;
INSERT INTO sys_feature_type VALUES ('FLWREG', 5);
ALTER TABLE sys_feature_type ADD CONSTRAINT sys_feature_type_check CHECK (((id)::text =
ANY (ARRAY[('ARC'::character varying)::text, ('CONNEC'::character varying)::text, ('ELEMENT'::character varying)::text,
ANY (ARRAY[('ARC'::character varying)::text, ('CONNEC'::character varying)::text, ('ELEMENT'::character varying)::text,
('GULLY'::character varying)::text, ('LINK'::character varying)::text, ('NODE'::character varying)::text, ('VNODE'::character varying)::text,
('FLWREG'::character varying)::text])));

Expand All @@ -349,14 +349,118 @@ INSERT INTO sys_feature_class VALUES ('ORIFICE', 'FLWREG', 'ORIFICE', '');
INSERT INTO sys_feature_class VALUES ('WEIR', 'FLWREG', 'WEIR', '');
INSERT INTO sys_feature_class VALUES ('PUMP', 'FLWREG', 'PUMP', '');
INSERT INTO sys_feature_class VALUES ('OUTLET', 'FLWREG', 'OUTLET', '');
ALTER TABLE sys_feature_class ADD CONSTRAINT sys_feature_cat_check CHECK (((id)::text = ANY (ARRAY[('CHAMBER'::character varying)::text,
('CONDUIT'::character varying)::text, ('CONNEC'::character varying)::text, ('GULLY'::character varying)::text,
ALTER TABLE sys_feature_class ADD CONSTRAINT sys_feature_cat_check CHECK (((id)::text = ANY (ARRAY[('CHAMBER'::character varying)::text,
('CONDUIT'::character varying)::text, ('CONNEC'::character varying)::text, ('GULLY'::character varying)::text,
('JUNCTION'::character varying)::text, ('MANHOLE'::character varying)::text, ('NETELEMENT'::character varying)::text,
('NETGULLY'::character varying)::text, ('NETINIT'::character varying)::text, ('OUTFALL'::character varying)::text,
('SIPHON'::character varying)::text, ('STORAGE'::character varying)::text, ('VALVE'::character varying)::text,
('VARC'::character varying)::text, ('WACCEL'::character varying)::text, ('WJUMP'::character varying)::text,
('NETGULLY'::character varying)::text, ('NETINIT'::character varying)::text, ('OUTFALL'::character varying)::text,
('SIPHON'::character varying)::text, ('STORAGE'::character varying)::text, ('VALVE'::character varying)::text,
('VARC'::character varying)::text, ('WACCEL'::character varying)::text, ('WJUMP'::character varying)::text,
('WWTP'::character varying)::text, ('ELEMENT'::character varying)::text, ('LINK'::character varying)::text,
('ORIFICE'::character varying)::text, ('WEIR'::character varying)::text, ('PUMP'::character varying)::text, ('OUTLET'::character varying)::text])));



-- 21/01/2025
ALTER TABLE temp_node RENAME TO _temp_node;
ALTER TABLE _temp_node RENAME CONSTRAINT temp_node_pkey TO _temp_node_pkey;
ALTER TABLE _temp_node RENAME CONSTRAINT temp_node_node_id_unique TO _temp_node_node_id_unique;

DROP INDEX IF EXISTS temp_node_epa_type;
DROP INDEX IF EXISTS temp_node_index;
DROP INDEX IF EXISTS temp_node_node_id;
DROP INDEX IF EXISTS temp_node_node_type;
DROP INDEX IF EXISTS temp_node_nodeparent;
DROP INDEX IF EXISTS temp_node_result_id;

CREATE TABLE temp_node (
id serial4 NOT NULL,
result_id varchar(30) NULL,
node_id varchar(16) NOT NULL,
top_elev numeric(12, 3) NULL,
ymax numeric(12, 3) NULL,
elev numeric(12, 3) NULL,
node_type varchar(30) NULL,
nodecat_id varchar(30) NULL,
epa_type varchar(16) NULL,
sector_id int4 NULL,
state int2 NULL,
state_type int2 NULL,
annotation varchar(254) NULL,
dma_id int4 NULL,
y0 numeric(12, 4) NULL,
ysur numeric(12, 4) NULL,
apond numeric(12, 4) NULL,
the_geom public.geometry(point, 25831) NULL,
expl_id int4 NULL,
addparam text NULL,
parent varchar(16) NULL,
arcposition int2 NULL,
fusioned_node text NULL,
age int4 NULL,
CONSTRAINT temp_node_node_id_unique UNIQUE (node_id),
CONSTRAINT temp_node_pkey PRIMARY KEY (id)
);
CREATE INDEX temp_node_epa_type ON temp_node USING btree (epa_type);
CREATE INDEX temp_node_index ON temp_node USING gist (the_geom);
CREATE INDEX temp_node_node_id ON temp_node USING btree (node_id);
CREATE INDEX temp_node_node_type ON temp_node USING btree (node_type);
CREATE INDEX temp_node_nodeparent ON temp_node USING btree (parent);
CREATE INDEX temp_node_result_id ON temp_node USING btree (result_id);
CREATE INDEX temp_node_dma_id ON temp_node USING btree (dma_id);

ALTER TABLE temp_arc RENAME TO _temp_arc;
ALTER TABLE temp_arc RENAME CONSTRAINT temp_arc_pkey TO _temp_arc_pkey;

DROP INDEX IF EXISTS temp_arc_arc_id;
DROP INDEX IF EXISTS temp_arc_arc_type;
DROP INDEX IF EXISTS temp_arc_epa_type;
DROP INDEX IF EXISTS temp_arc_index;
DROP INDEX IF EXISTS temp_arc_node_1_type;
DROP INDEX IF EXISTS temp_arc_node_2_type;
DROP INDEX IF EXISTS temp_arc_result_id;


CREATE TABLE temp_arc (
id serial4 NOT NULL,
result_id varchar(30) NULL,
arc_id varchar(16) NOT NULL,
node_1 varchar(16) NULL,
node_2 varchar(16) NULL,
elevmax1 numeric(12, 3) NULL,
elevmax2 numeric(12, 3) NULL,
arc_type varchar(30) NULL,
arccat_id varchar(30) NULL,
epa_type varchar(16) NULL,
sector_id int4 NULL,
state int2 NULL,
state_type int2 NULL,
annotation varchar(254) NULL,
dma_id int4 NULL,
length numeric(12, 3) NULL,
n numeric(12, 3) NULL,
the_geom public.geometry(linestring, 25831) NULL,
expl_id int4 NULL,
addparam text NULL,
arcparent varchar(16) NULL,
q0 float8 NULL,
qmax float8 NULL,
barrels int4 NULL,
slope float8 NULL,
flag bool NULL,
culvert varchar(10) NULL,
kentry numeric(12, 4) NULL,
kexit numeric(12, 4) NULL,
kavg numeric(12, 4) NULL,
flap varchar(3) NULL,
seepage numeric(12, 4) NULL,
age int4 NULL,
CONSTRAINT temp_arc_pkey PRIMARY KEY (id)
);
CREATE INDEX temp_arc_arc_id ON temp_arc USING btree (arc_id);
CREATE INDEX temp_arc_arc_type ON temp_arc USING btree (arc_type);
CREATE INDEX temp_arc_epa_type ON temp_arc USING btree (epa_type);
CREATE INDEX temp_arc_index ON temp_arc USING gist (the_geom);
CREATE INDEX temp_arc_node_1_type ON temp_arc USING btree (node_1);
CREATE INDEX temp_arc_node_2_type ON temp_arc USING btree (node_2);
CREATE INDEX temp_arc_dma_id ON temp_arc USING btree (dma_id);
CREATE INDEX temp_arc_result_id ON temp_arc USING btree (result_id);
10 changes: 10 additions & 0 deletions updates/40/40000/ud/dml.sql
Original file line number Diff line number Diff line change
Expand Up @@ -2525,3 +2525,13 @@ INSERT INTO config_form_tabs (formname, tabname, "label", tooltip, sys_role, tab
"disabled": false
}
]'::json, 0, '{4,5}');

INSERT INTO temp_node (id, result_id, node_id, top_elev, ymax, elev, node_type, nodecat_id, epa_type, sector_id, state, state_type, annotation, dma_id, y0, ysur, apond, the_geom, expl_id, addparam, parent, arcposition, fusioned_node, age)
SELECT id, result_id, node_id, top_elev, ymax, elev, node_type, nodecat_id, epa_type, sector_id, state, state_type, annotation, NULL, y0, ysur, apond, the_geom, expl_id, addparam, parent, arcposition, fusioned_node, age
FROM _temp_node;

INSERT INTO temp_arc (id, result_id, arc_id, node_1, node_2, elevmax1, elevmax2, arc_type, arccat_id, epa_type, sector_id, state, state_type, annotation, dma_id, length, n, the_geom, expl_id,
addparam, arcparent, q0, qmax, barrels, slope, flag, culvert, kentry, kexit, kavg, flap, seepage, age)
SELECT id, result_id, arc_id, node_1, node_2, elevmax1, elevmax2, arc_type, arccat_id, epa_type, sector_id, state, state_type, annotation, NULL, length, n, the_geom, expl_id,
addparam, arcparent, q0, qmax, barrels, slope, flag, culvert, kentry, kexit, kavg, flap, seepage, age
FROM _temp_arc;
8 changes: 4 additions & 4 deletions updates/40/40000/utils/dml_issue_30.sql
Original file line number Diff line number Diff line change
Expand Up @@ -812,7 +812,7 @@ except_msg = 'links over nodarc (go2epa)',
query_text = 'select link_id as arc_id, conneccat_id as arccat_id, a.expl_id, l.the_geom FROM t_link l, temp_t_arc a WHERE st_dwithin(st_endpoint(l.the_geom), a.the_geom, 0.001) AND a.epa_type NOT IN (''CONDUIT'', ''PIPE'', ''VIRTUALVALVE'', ''VIRTUALPUMP'')',
info_msg = 'No links over nodarc found',
project_type = 'ud',
except_table = 'anl_node',
except_table = 'anl_arc'
function_name = '[gw_fct_pg2epa_check_network]',
active = true
WHERE fid = 404;
Expand Down Expand Up @@ -945,9 +945,9 @@ query_text = '
WITH
outlayer AS (SELECT ((value::json->>''elevation'')::json->>''max'')::numeric as max_elev,
((value::json->>''elevation'')::json->>''min'')::numeric as min_elev FROM config_param_system WHERE parameter = ''epa_outlayer_values'')
select node_id, nodecat_id from outlayer, node where elevation < min_elev or elevation > max_elev
select node_id, nodecat_id from outlayer, node where top_elev < min_elev or top_elev > max_elev
union
select connec_id, conneccat_id from outlayer, connec where elevation < min_elev or elevation > max_elev',
select connec_id, conneccat_id from outlayer, connec where top_elev < min_elev or top_elev > max_elev',
except_table = null,
function_name = '[gw_fct_pg2epa_check_result]',
active = true
Expand Down Expand Up @@ -1026,7 +1026,7 @@ except_level = 3,
except_msg = 'Controls with links (arc o nodarc) are not present on this result',
info_msg = 'All Controls has correct link id (arc or nodarc) values.',
query_text = '
(SELECT a.id, a.arc_id as controls, b.arc_id as templayer FROM
SELECT * FROM (SELECT a.id, a.arc_id as controls, b.arc_id as templayer FROM
(SELECT substring(split_part(text,''LINK '', 2) FROM ''[^ ]+''::text) arc_id, id, sector_id FROM inp_controls WHERE active is true)a
LEFT JOIN temp_t_arc b USING (arc_id)
WHERE b.arc_id IS NULL AND a.arc_id IS NOT NULL
Expand Down
6 changes: 3 additions & 3 deletions utils/fct/gw_fct_create_logreturn.sql
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ BEGIN
v_result := concat ('{"geometryType":"Point", "features":',v_result,',"category_field":"descript"}');

ELSIF v_returntype = 'line' THEN

v_result = null;
SELECT jsonb_agg(features.feature) INTO v_result
FROM (
Expand All @@ -89,9 +89,9 @@ BEGIN
) row) features;
v_result := COALESCE(v_result, '{}');
v_result = concat ('{"geometryType":"LineString", "features":',v_result, ',"category_field":"descript"}');

ELSIF v_returntype = 'polygon' THEN

SELECT jsonb_agg(features.feature) INTO v_result
FROM (
SELECT jsonb_build_object(
Expand Down
4 changes: 3 additions & 1 deletion utils/fct/gw_fct_create_logtables.sql
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,9 @@ BEGIN
AND cur_user = current_user'::text) as ct(cur_user varchar(50), inp_options_interval_from text, inp_options_interval_to text))row
INTO v_options;

SELECT count(*) INTO v_doublen2a FROM v_edit_inp_pump WHERE pump_type = 'PRESSPUMP';
IF v_project_type = 'WS' THEN
SELECT count(*) INTO v_doublen2a FROM v_edit_inp_pump WHERE pump_type = 'PRESSPUMP';
END IF;

SELECT value INTO v_patternmethod FROM config_param_user WHERE parameter = 'inp_options_patternmethod' AND cur_user=current_user;
SELECT value INTO v_dscenario FROM config_param_user WHERE parameter = 'inp_options_dscenario_priority' AND cur_user=current_user;
Expand Down
30 changes: 26 additions & 4 deletions utils/fct/gw_fct_create_querytables.sql
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,9 @@ BEGIN
IF v_epacheck THEN
v_filter = concat(v_filter, ' AND sector_id IN (select sector_id from selector_sector where cur_user = current_user)');

DROP TABLE IF EXISTS t_inp_pump; EXECUTE 'CREATE TEMP TABLE t_inp_pump AS SELECT * FROM v_edit_inp_pump'||v_filter;
IF v_project_type = 'WS' THEN
DROP TABLE IF EXISTS t_inp_pipe; EXECUTE 'CREATE TEMP TABLE t_inp_pipe AS SELECT * FROM v_edit_inp_pipe'||v_filter;
DROP TABLE IF EXISTS t_inp_pump; EXECUTE 'CREATE TEMP TABLE t_inp_pump AS SELECT * FROM v_edit_inp_pump'||v_filter;
DROP TABLE IF EXISTS t_inp_valve; EXECUTE 'CREATE TEMP TABLE t_inp_valve AS SELECT * FROM v_edit_inp_valve'||v_filter;
DROP TABLE IF EXISTS t_inp_junction; EXECUTE 'CREATE TEMP TABLE t_inp_junction AS SELECT * FROM v_edit_inp_junction'||v_filter;
DROP TABLE IF EXISTS t_inp_reservoir; EXECUTE 'CREATE TEMP TABLE t_inp_reservoir AS SELECT * FROM v_edit_inp_reservoir'||v_filter;
Expand All @@ -97,23 +97,45 @@ BEGIN
DROP TABLE IF EXISTS t_inp_virtualpump; EXECUTE 'CREATE TEMP TABLE t_inp_virtualpump AS SELECT * FROM v_edit_inp_virtualpump'||v_filter;

ELSIF v_project_type = 'UD' THEN
DROP TABLE IF EXISTS t_inp_gully;EXECUTE 'CREATE TEMP TABLE t_inp_gully AS SELECT * FROM v_edit_inp_gully'||v_filter;
DROP TABLE IF EXISTS t_inp_conduit; EXECUTE 'CREATE TEMP TABLE t_inp_conduit AS SELECT * FROM v_edit_inp_conduit'||v_filter;
DROP TABLE IF EXISTS t_inp_outlet; EXECUTE 'CREATE TEMP TABLE t_inp_outlet AS SELECT * FROM v_edit_inp_outlet'||v_filter;
DROP TABLE IF EXISTS t_inp_orifice; EXECUTE 'CREATE TEMP TABLE t_inp_orifice AS SELECT * FROM v_edit_inp_orifice'||v_filter;
DROP TABLE IF EXISTS t_inp_weir; EXECUTE 'CREATE TEMP TABLE t_inp_weir AS SELECT * FROM v_edit_inp_weir'||v_filter;
DROP TABLE IF EXISTS t_inp_virtual; EXECUTE 'CREATE TEMP TABLE t_inp_virtual AS SELECT * FROM v_edit_inp_virtual'||v_filter;
DROP TABLE IF EXISTS t_inp_storage; EXECUTE 'CREATE TEMP TABLE t_inp_storage AS SELECT * FROM v_edit_inp_storage'||v_filter;
DROP TABLE IF EXISTS t_inp_subcatchment; EXECUTE 'CREATE TEMP TABLE t_inp_subcatchment AS SELECT * FROM v_edit_inp_subcatchment';
DROP TABLE IF EXISTS t_inp_junction; EXECUTE 'CREATE TEMP TABLE t_inp_junction AS SELECT * FROM v_edit_inp_junction'||v_filter;
DROP TABLE IF EXISTS t_inp_outfall; EXECUTE 'CREATE TEMP TABLE t_inp_outfall AS SELECT * FROM v_edit_inp_outfall'||v_filter;
DROP TABLE IF EXISTS t_inp_divider; EXECUTE 'CREATE TEMP TABLE t_inp_divider AS SELECT * FROM v_edit_inp_divider'||v_filter;
DROP TABLE IF EXISTS t_inp_subc2outlet; EXECUTE 'CREATE TEMP TABLE t_inp_subc2outlet AS SELECT * FROM v_edit_inp_subc2outlet';
DROP TABLE IF EXISTS t_inp_netgully; EXECUTE 'CREATE TEMP TABLE t_inp_netgully AS SELECT * FROM v_edit_inp_netgully'||v_filter;
DROP TABLE IF EXISTS t_inp_gully; EXECUTE 'CREATE TEMP TABLE t_inp_gully AS SELECT * FROM v_edit_inp_gully'||v_filter;
DROP TABLE IF EXISTS t_raingage; EXECUTE 'CREATE TEMP TABLE t_raingage AS SELECT * FROM v_edit_raingage';
END IF;
END IF;

-- create log tables
DROP TABLE IF EXISTS t_audit_check_data; EXECUTE 'CREATE TEMP TABLE t_audit_check_data AS SELECT * FROM audit_check_data';
DROP TABLE IF EXISTS t_audit_check_project; EXECUTE 'CREATE TEMP TABLE t_audit_check_project AS SELECT * FROM audit_check_project';

ALTER TABLE t_audit_check_data ALTER COLUMN id SET DEFAULT nextval('SCHEMA_NAME.audit_check_data_id_seq'::regclass);


-- create anl tables
DROP TABLE IF EXISTS t_anl_node; EXECUTE 'CREATE TEMP TABLE t_anl_node AS SELECT * FROM anl_node WHERE cur_user = current_user';
DROP TABLE IF EXISTS t_anl_node; EXECUTE 'CREATE TEMP TABLE t_anl_node AS SELECT * FROM anl_node WHERE cur_user = current_user';
DROP TABLE IF EXISTS t_anl_arc; EXECUTE 'CREATE TEMP TABLE t_anl_arc AS SELECT * FROM anl_arc WHERE cur_user = current_user';
DROP TABLE IF EXISTS t_anl_connec; EXECUTE 'CREATE TEMP TABLE t_anl_connec AS SELECT * FROM anl_connec WHERE cur_user = current_user';
DROP TABLE IF EXISTS t_anl_polygon; EXECUTE 'CREATE TEMP TABLE t_anl_polygon AS SELECT * FROM anl_polygon WHERE cur_user = current_user';

ALTER TABLE t_audit_check_data ALTER COLUMN id SET DEFAULT nextval('SCHEMA_NAME.audit_check_data_id_seq'::regclass);
ALTER TABLE t_anl_node ALTER COLUMN id SET DEFAULT nextval('SCHEMA_NAME.anl_node_id_seq'::regclass);
ALTER TABLE t_anl_node ALTER COLUMN cur_user SET DEFAULT '"current_user"()';
ALTER TABLE t_anl_arc ALTER COLUMN id SET DEFAULT nextval('SCHEMA_NAME.anl_arc_id_seq'::regclass);
ALTER TABLE t_anl_arc ALTER COLUMN cur_user SET DEFAULT '"current_user"()';
ALTER TABLE t_anl_connec ALTER COLUMN id SET DEFAULT nextval('SCHEMA_NAME.anl_connec_id_seq'::regclass);
ALTER TABLE t_anl_connec ALTER COLUMN cur_user SET DEFAULT '"current_user"()';
ALTER TABLE t_anl_polygon ALTER COLUMN id SET DEFAULT nextval('SCHEMA_NAME.anl_polygon_id_seq'::regclass);
ALTER TABLE t_anl_polygon ALTER COLUMN cur_user SET DEFAULT '"current_user"()';


-- Return
RETURN '{"status":"ok"}';
Expand Down
6 changes: 3 additions & 3 deletions utils/fct/gw_fct_pg2epa_check_data.sql
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,12 @@ BEGIN
--raise exception 'v_sql %', v_sql;
-- create log tables
EXECUTE 'SELECT gw_fct_create_logtables($${"data":{"parameters":{"fid":'||v_fid||'}}}$$::json)';

END IF;

-- getting sys_fprocess to be executed
v_querytext = 'select * from sys_fprocess where project_type in (lower('||quote_literal(v_project_type)||'), ''utils'')
and addparam is null and query_text is not null and function_name ilike ''%pg2epa_check_data%'' and active order by fid asc';
v_querytext = 'SELECT * FROM sys_fprocess WHERE project_type IN (LOWER('||quote_literal(v_project_type)||'), ''utils'')
AND addparam IS NULL AND (query_text IS NOT NULL AND query_text <> '''') AND function_name ILIKE ''%pg2epa_check_data%'' AND active ORDER BY fid ASC';

-- loop for checks
for v_rec in execute v_querytext
Expand Down
Loading

0 comments on commit 65d157b

Please sign in to comment.