create or replace function move_pdc_realtime_data() returns trigger as
$$

begin
    insert into t_pdc_device_data (id, create_time, create_user_id, file_ids, update_time, update_user_id, code, name,
                                   remarks, sort_key, status, organization_id, batch_data, class_data, day_data,
                                   fault_data,
                                   fault_info, fixed_data, flow_data, load_data, modbusuid, month_data, net_data,
                                   output_data, process1data, process2data, speed_data, "time", total_data,
                                   device_id)
    values (new.id, new.create_time, new.create_user_id, new.file_ids, new.update_time, new.update_user_id, new.code,
            new.name,
            new.remarks, new.sort_key, new.status, new.organization_id, new.batch_data, new.class_data, new.day_data,
            new.fault_data,
            new.fault_info, new.fixed_data, new.flow_data, new.load_data, new.modbusuid, new.month_data, new.net_data,
            new.output_data, new.process1data, new.process2data, new.speed_data, new."time", new.total_data,
            new.device_id);

    return new;


end


$$
    language plpgsql;


--添加触发器

create or replace trigger move_pdc_realtime_data_trigger

    after insert or update
    on t_pdc_device_real_time_data

    for each row

execute procedure move_pdc_realtime_data();
