From 20720ba541f4f3e604339e42d4b85a1eb70c2394 Mon Sep 17 00:00:00 2001 From: Marc Rejohn Castillano Date: Fri, 20 Mar 2026 18:28:24 +0800 Subject: [PATCH] Fix SQL syntax error in pg_cron.schedule() calls Replace dollar-quoted strings with simple single-quoted strings in cron.schedule() function calls. The cron.schedule() function expects text literals, not dollar-quoted blocks. Use quote_literal() for the interval value in the cleanup query to properly escape the string. --- .../migrations/20260321_extend_scheduled_notifications.sql | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/supabase/migrations/20260321_extend_scheduled_notifications.sql b/supabase/migrations/20260321_extend_scheduled_notifications.sql index 194740d4..ae803850 100644 --- a/supabase/migrations/20260321_extend_scheduled_notifications.sql +++ b/supabase/migrations/20260321_extend_scheduled_notifications.sql @@ -490,22 +490,21 @@ BEGIN PERFORM cron.schedule( 'notification_enqueue_every_min', '*/1 * * * *', - $$SELECT public.enqueue_all_notifications();$$ + 'SELECT public.enqueue_all_notifications();' ); -- Job 2: Process notification queue via pg_net every minute PERFORM cron.schedule( 'notification_process_every_min', '*/1 * * * *', - $$SELECT public.process_notification_queue();$$ + 'SELECT public.process_notification_queue();' ); -- Job 3: Daily cleanup of old processed notifications PERFORM cron.schedule( 'cleanup_old_notifications', '0 3 * * *', - $$DELETE FROM scheduled_notifications WHERE processed = true AND processed_at < now() - interval '7 days'; - DELETE FROM notification_pushes WHERE pushed_at < now() - interval '7 days';$$ + 'DELETE FROM scheduled_notifications WHERE processed = true AND processed_at < now() - interval ' || quote_literal('7 days') || '; DELETE FROM notification_pushes WHERE pushed_at < now() - interval ' || quote_literal('7 days') || ';' ); EXCEPTION WHEN others THEN