I’m trying to set up a heartbeat_agg as per the documentation, however I get the following error:
SQL Error [42883]: ERROR: function heartbeat_agg(timestamp with time zone, timestamp with time zone, interval, interval) does not exist
Hint: No function matches the given name and argument types. You might need to add explicit type casts.
This is the script I’m running:
CREATE MATERIALIZED VIEW sensor_hourly_heartbeat AS
SELECT
time_bucket('1 hour', time) as hour,
seen_by_sensor_id AS sensor_id,
heartbeat_agg(time::timestamptz, time_bucket('1 hour', time), INTERVAL '1 hour', INTERVAL '1 minute') AS heartbeat
FROM ap_seen_record
GROUP BY seen_by_sensor_id;
From what I can tell, schema public doesn’t have access to this function, only toolkit_experimental:
SELECT n.nspname AS schema,
p.proname AS function_name,
pg_get_function_identity_arguments(p.oid) AS function_arguments,
d.description
FROM pg_proc p
JOIN pg_namespace n ON p.pronamespace = n.oid
LEFT JOIN pg_description d ON p.oid = d.objoid
WHERE p.proname = 'heartbeat_agg';
schema |function_name|function_arguments |description|
--------------------+-------------+--------------------------------------------------------------------------------------------------------------------------+-----------+
toolkit_experimental|heartbeat_agg|heartbeat timestamp with time zone, agg_start timestamp with time zone, agg_duration interval, heartbeat_liveness interval| |
How can I add this to ‘public’?