-- 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);
