cardyet
03/12/2022, 3:43 AMselect
cron.schedule(
'webhook-every-day', -- name of the cron job
'1 0 * * *', -- every day at 12:01am
$$
-- declare variable
declare
results setof events
-- start::query reminders table
RETURN QUERY SELECT title, date
INTO results
FROM events
WHERE CAST(date AS DATE) = NOW()::DATE
-- end::query
select status
from
http_post(
'https://api.com/',
results, -- payload as an array of rows?
'application/json'
)
$$
);
This produces an error at or near setof events
Needle
03/12/2022, 3:43 AM/title
command!
We have solved your problem?
Click the button below to archive it.DanMossa
03/12/2022, 4:34 AMNeedle
03/12/2022, 4:34 AMcardyet
03/12/2022, 12:04 PMERROR: syntax error at or near "setof" LINE 4: results setof events; ^
line 4 doesn't line up with setof though