From 3061930c9bde1f60b4db7fe14b8ca2b2a55ec0bf Mon Sep 17 00:00:00 2001 From: mguzman14 Date: Mon, 5 Aug 2024 17:04:15 +0200 Subject: [PATCH] feat(v_views): replace references to v_arc/node with v_edit_arc/node --- ud/fct/ud_gw_fct_pg2epa_export_inp.sql | 8 ++++---- ud/fct/ud_gw_fct_pg2epa_fill_data.sql | 22 +++++++++++----------- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/ud/fct/ud_gw_fct_pg2epa_export_inp.sql b/ud/fct/ud_gw_fct_pg2epa_export_inp.sql index 693aa2e37a..7e1b04bb38 100644 --- a/ud/fct/ud_gw_fct_pg2epa_export_inp.sql +++ b/ud/fct/ud_gw_fct_pg2epa_export_inp.sql @@ -198,7 +198,7 @@ BEGIN FROM inp_coverage JOIN v_edit_inp_subcatchment ON inp_coverage.subc_id::text = v_edit_inp_subcatchment.subc_id::text LEFT JOIN ( SELECT DISTINCT ON (a.subc_id) a.subc_id, - v_node.node_id + v_edit_node.node_id FROM ( SELECT unnest(inp_subcatchment.outlet_id::text[]) AS node_array, inp_subcatchment.subc_id, inp_subcatchment.outlet_id, @@ -233,7 +233,7 @@ BEGIN inp_subcatchment.descript FROM inp_subcatchment WHERE "left"(inp_subcatchment.outlet_id::text, 1) = '{'::text) a - JOIN v_node ON v_node.node_id::text = a.node_array) b ON v_edit_inp_subcatchment.subc_id::text = b.subc_id::text; + JOIN v_edit_node ON v_edit_node.node_id::text = a.node_array) b ON v_edit_inp_subcatchment.subc_id::text = b.subc_id::text; CREATE OR REPLACE TEMP VIEW vi_t_dividers AS @@ -351,7 +351,7 @@ BEGIN FROM v_edit_inp_subcatchment JOIN inp_groundwater ON inp_groundwater.subc_id::text = v_edit_inp_subcatchment.subc_id::text LEFT JOIN ( SELECT DISTINCT ON (a.subc_id) a.subc_id, - v_node.node_id + v_edit_node.node_id FROM ( SELECT unnest(inp_subcatchment.outlet_id::text[]) AS node_array, inp_subcatchment.subc_id, inp_subcatchment.outlet_id, @@ -386,7 +386,7 @@ BEGIN inp_subcatchment.descript FROM inp_subcatchment WHERE "left"(inp_subcatchment.outlet_id::text, 1) = '{'::text) a - JOIN v_node ON v_node.node_id::text = a.node_array) b ON v_edit_inp_subcatchment.subc_id::text = b.subc_id::text; + JOIN v_edit_node ON v_edit_node.node_id::text = a.node_array) b ON v_edit_inp_subcatchment.subc_id::text = b.subc_id::text; CREATE OR REPLACE TEMP VIEW vi_t_gully AS diff --git a/ud/fct/ud_gw_fct_pg2epa_fill_data.sql b/ud/fct/ud_gw_fct_pg2epa_fill_data.sql index 0a63f1bc72..5dc0f5ded1 100644 --- a/ud/fct/ud_gw_fct_pg2epa_fill_data.sql +++ b/ud/fct/ud_gw_fct_pg2epa_fill_data.sql @@ -76,9 +76,9 @@ BEGIN LEFT JOIN v_edit_node USING (node_id) -- we need to use v_edit_node to work with sys_* fields JOIN inp_junction ON node.node_id=inp_junction.node_id JOIN ( - SELECT node_1 AS node_id FROM selector_sector s, v_arc a JOIN value_state_type ON id=state_type WHERE a.sector_id > 0 AND a.sector_id = s.sector_id and current_user = cur_user AND epa_type !=''UNDEFINED'' '|| + SELECT node_1 AS node_id FROM selector_sector s, v_edit_arc a JOIN value_state_type ON id=state_type WHERE a.sector_id > 0 AND a.sector_id = s.sector_id and current_user = cur_user AND epa_type !=''UNDEFINED'' '|| v_statetype ||' UNION - SELECT node_2 FROM selector_sector s, v_arc a JOIN value_state_type ON id=state_type WHERE a.sector_id > 0 AND a.sector_id = s.sector_id and current_user = cur_user AND epa_type !=''UNDEFINED'' '|| + SELECT node_2 FROM selector_sector s, v_edit_arc a JOIN value_state_type ON id=state_type WHERE a.sector_id > 0 AND a.sector_id = s.sector_id and current_user = cur_user AND epa_type !=''UNDEFINED'' '|| v_statetype ||')a ON node.node_id=a.node_id UNION SELECT '||quote_literal(result_id_var)||', @@ -88,9 +88,9 @@ BEGIN LEFT JOIN v_edit_node USING (node_id) JOIN inp_divider ON node.node_id=inp_divider.node_id JOIN ( - SELECT node_1 AS node_id FROM selector_sector s, v_arc a JOIN value_state_type ON id=state_type WHERE a.sector_id > 0 AND a.sector_id = s.sector_id and current_user = cur_user AND epa_type !=''UNDEFINED'' '|| + SELECT node_1 AS node_id FROM selector_sector s, v_edit_arc a JOIN value_state_type ON id=state_type WHERE a.sector_id > 0 AND a.sector_id = s.sector_id and current_user = cur_user AND epa_type !=''UNDEFINED'' '|| v_statetype ||' UNION - SELECT node_2 FROM selector_sector s, v_arc a JOIN value_state_type ON id=state_type WHERE a.sector_id > 0 AND a.sector_id = s.sector_id and current_user = cur_user AND epa_type !=''UNDEFINED'' '|| + SELECT node_2 FROM selector_sector s, v_edit_arc a JOIN value_state_type ON id=state_type WHERE a.sector_id > 0 AND a.sector_id = s.sector_id and current_user = cur_user AND epa_type !=''UNDEFINED'' '|| v_statetype ||')a ON node.node_id=a.node_id UNION SELECT '||quote_literal(result_id_var)||', @@ -100,9 +100,9 @@ BEGIN LEFT JOIN v_edit_node USING (node_id) JOIN inp_storage ON node.node_id=inp_storage.node_id JOIN ( - SELECT node_1 AS node_id FROM selector_sector s, v_arc a JOIN value_state_type ON id=state_type WHERE a.sector_id > 0 AND a.sector_id = s.sector_id and current_user = cur_user AND epa_type !=''UNDEFINED'' '|| + SELECT node_1 AS node_id FROM selector_sector s, v_edit_arc a JOIN value_state_type ON id=state_type WHERE a.sector_id > 0 AND a.sector_id = s.sector_id and current_user = cur_user AND epa_type !=''UNDEFINED'' '|| v_statetype ||' UNION - SELECT node_2 FROM selector_sector s, v_arc a JOIN value_state_type ON id=state_type WHERE a.sector_id > 0 AND a.sector_id = s.sector_id and current_user = cur_user AND epa_type !=''UNDEFINED'' '|| + SELECT node_2 FROM selector_sector s, v_edit_arc a JOIN value_state_type ON id=state_type WHERE a.sector_id > 0 AND a.sector_id = s.sector_id and current_user = cur_user AND epa_type !=''UNDEFINED'' '|| v_statetype ||')a ON node.node_id=a.node_id UNION SELECT '||quote_literal(result_id_var)||', @@ -112,9 +112,9 @@ BEGIN LEFT JOIN v_edit_node USING (node_id) JOIN inp_outfall ON node.node_id=inp_outfall.node_id JOIN ( - SELECT node_1 AS node_id FROM selector_sector s, v_arc a JOIN value_state_type ON id=state_type WHERE a.sector_id > 0 AND a.sector_id = s.sector_id and current_user = cur_user AND epa_type !=''UNDEFINED'' '|| + SELECT node_1 AS node_id FROM selector_sector s, v_edit_arc a JOIN value_state_type ON id=state_type WHERE a.sector_id > 0 AND a.sector_id = s.sector_id and current_user = cur_user AND epa_type !=''UNDEFINED'' '|| v_statetype ||' UNION - SELECT node_2 FROM selector_sector s, v_arc a JOIN value_state_type ON id=state_type WHERE a.sector_id > 0 AND a.sector_id = s.sector_id and current_user = cur_user AND epa_type !=''UNDEFINED'' '|| + SELECT node_2 FROM selector_sector s, v_edit_arc a JOIN value_state_type ON id=state_type WHERE a.sector_id > 0 AND a.sector_id = s.sector_id and current_user = cur_user AND epa_type !=''UNDEFINED'' '|| v_statetype ||')a ON node.node_id=a.node_id UNION SELECT '||quote_literal(result_id_var)||', @@ -124,9 +124,9 @@ BEGIN LEFT JOIN v_edit_node USING (node_id) JOIN inp_netgully ON node.node_id=inp_netgully.node_id JOIN ( - SELECT node_1 AS node_id FROM selector_sector s, v_arc a JOIN value_state_type ON id=state_type WHERE a.sector_id > 0 AND a.sector_id = s.sector_id and current_user = cur_user AND epa_type !=''UNDEFINED'' '|| + SELECT node_1 AS node_id FROM selector_sector s, v_edit_arc a JOIN value_state_type ON id=state_type WHERE a.sector_id > 0 AND a.sector_id = s.sector_id and current_user = cur_user AND epa_type !=''UNDEFINED'' '|| v_statetype ||' UNION - SELECT node_2 FROM selector_sector s, v_arc a JOIN value_state_type ON id=state_type WHERE a.sector_id > 0 AND a.sector_id = s.sector_id and current_user = cur_user AND epa_type !=''UNDEFINED'' '|| + SELECT node_2 FROM selector_sector s, v_edit_arc a JOIN value_state_type ON id=state_type WHERE a.sector_id > 0 AND a.sector_id = s.sector_id and current_user = cur_user AND epa_type !=''UNDEFINED'' '|| v_statetype ||')a ON node.node_id=a.node_id'; @@ -182,7 +182,7 @@ BEGIN barrels, slope, culvert, kentry, kexit, kavg, flap, seepage, (now()::date-a.builtdate)/30 - FROM selector_sector, v_arc a + FROM selector_sector, v_edit_arc a LEFT JOIN value_state_type ON id=state_type LEFT JOIN cat_mat_arc ON matcat_id = cat_mat_arc.id LEFT JOIN inp_conduit ON a.arc_id = inp_conduit.arc_id