tww
.tww_app
Tables
(current)
Columns
Constraints
Relationships
Orphan Tables
Anomalies
Routines
ft_vw_tww_overflow_insert()
Parameters
Name
Type
Mode
IN
Definition
DECLARE BEGIN INSERT INTO tww_od.overflow ( obj_id , actuation , adjustability , brand , control , discharge_point , fk_control_center , fk_dataowner , fk_overflow_char , fk_overflow_to , fk_provider , fk_wastewater_node , function , gross_costs , identifier , last_modification , qon_dim , remark , signal_transmission , subsidies ) VALUES ( COALESCE( NEW.obj_id, tww_app.generate_oid('tww_od'::text, 'overflow'::text) ) , NEW.actuation , NEW.adjustability , NEW.brand , NEW.control , NEW.discharge_point , NEW.fk_control_center , NEW.fk_dataowner , NEW.fk_overflow_char , NEW.fk_overflow_to , NEW.fk_provider , NEW.fk_wastewater_node , NEW.function , NEW.gross_costs , NEW.identifier , NEW.last_modification , NEW.qon_dim , NEW.remark , NEW.signal_transmission , NEW.subsidies ) RETURNING obj_id INTO NEW.obj_id; CASE WHEN NEW.overflow_type = 'leapingweir'::tww_app.overflow_type THEN INSERT INTO tww_od.leapingweir ( obj_id , length , opening_shape , width ) VALUES ( NEW.obj_id -- obj_id , NEW.length , NEW.opening_shape , NEW.width ); WHEN NEW.overflow_type = 'prank_weir'::tww_app.overflow_type THEN INSERT INTO tww_od.prank_weir ( obj_id , hydraulic_overflow_length , level_max , level_min , weir_edge , weir_kind ) VALUES ( NEW.obj_id -- obj_id , NEW.hydraulic_overflow_length , NEW.level_max , NEW.level_min , NEW.weir_edge , NEW.weir_kind ); WHEN NEW.overflow_type = 'pump'::tww_app.overflow_type THEN INSERT INTO tww_od.pump ( obj_id , construction_type , operating_point , placement_of_actuation , placement_of_pump , pump_flow_max_single , pump_flow_min_single , start_level , stop_level ) VALUES ( NEW.obj_id -- obj_id , NEW.construction_type , NEW.operating_point , NEW.placement_of_actuation , NEW.placement_of_pump , NEW.pump_flow_max_single , NEW.pump_flow_min_single , NEW.start_level , NEW.stop_level ); ELSE RAISE NOTICE 'vw_tww_overflow type not known (%)', NEW.overflow_type; -- ERROR END CASE; RETURN NEW; END;