sql/135: IMMUTABLE derivation helpers (modulation NRZ/PAM4/DP-16QAM/DP-QPSK/ Coherent, fec_type, inbuilt_fec, coherent) keyed off speed_gbps + form_factor + part_number/standard_name regex. Fill-only, idempotent via fn_tip_enrich_modulation_fec() + daily self-healing cron. Coverage >=100G 3-8% -> 46%. Rules built by a 4-lens optical-standards workflow, adversarially verified (10G-ZR, CFP2-DCO, AOC/DAC scope, bare-QSFP28 fixes folded in before apply). sql/136: speed_gbps made nullable + tip_speed_is_implausible() + BEFORE trigger trg_speed_plausibility (sanitize junk to NULL on write, never abort). One-time cleanup nulled 4708 junk rows (reversible via tip_speed_gbps_rollback); legit FC/SDI/CPRI/OTN gray band preserved. sql/137: v_transceiver_speed_errors flags only real optics -> 596 (was 2134).
14 lines
742 B
SQL
14 lines
742 B
SQL
-- 137 Make v_transceiver_speed_errors count only genuine optics.
|
|
--
|
|
-- After 136 nulled junk speed, the old definition (speed_gbps IS NULL OR <= 0)
|
|
-- counted 4708 rows, but 4112 of them are dac/aoc/aec/accessory where speed_gbps
|
|
-- is meaningless and NULL is correct. A speed error is a real optic (module) with
|
|
-- a missing or physically-impossible speed. This drops the count to the ~596 real
|
|
-- modules that still need a recoverable speed.
|
|
|
|
CREATE OR REPLACE VIEW v_transceiver_speed_errors AS
|
|
SELECT id, part_number, speed_gbps, form_factor, product_type
|
|
FROM transceivers
|
|
WHERE coalesce(product_type,'') NOT IN ('dac','aoc','aec','accessory','switch','nic')
|
|
AND (speed_gbps IS NULL OR speed_gbps <= 0 OR speed_gbps > 1600);
|