create or replace view power_v as select time, cast(values->'ActivePowerL1'->>'value' as float) as power_l1, cast(values->'ActivePowerL2'->>'value' as float) as power_l2, cast(values->'ActivePowerL3'->>'value' as float) as power_l3, cast(values->'ActivePowerL123'->>'value' as float) as power_total, cast(values->'PowerfactorL1'->>'value' as float) as factor_l1, cast(values->'PowerfactorL2'->>'value' as float) as factor_l2, cast(values->'PowerfactorL3'->>'value' as float) as factor_l3, device from measurements where application = 'com-passavant-geiger-poc' and attributes->>'FPort' = '1';