CREATE VIEW metric.replication_lag AS
SELECT
    pg_stat_replication.client_addr,
    public.wal_location_to_int(pg_current_xlog_location()) - public.wal_location_to_int(pg_stat_replication.replay_location) AS bytes_lag
FROM pg_stat_replication;

CREATE VIEW metric.replication_lag AS
SELECT
    pg_stat_replication.client_addr,
    pg_current_xlog_location() - pg_stat_replication.replay_location AS bytes_lag
FROM pg_stat_replication;

Replace use of wal_location_to_int function with native operator
Replace use of wal_location_to_int function with native operator
