© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
SupabaseS
Supabase•3y ago•
6 replies
chrysb

Is it possible to use .or() in an update w/ .select()?

I've been trying to basically run this query through the supabase abstraction:

  UPDATE notifications
  SET processingAt = NOW()
  WHERE (processingAt IS NULL OR processingAt < '${fiveMinutesAgo}')
    AND deliveredAt IS NULL
    AND subscriberKey IS NOT NULL
  RETURNING *
  UPDATE notifications
  SET processingAt = NOW()
  WHERE (processingAt IS NULL OR processingAt < '${fiveMinutesAgo}')
    AND deliveredAt IS NULL
    AND subscriberKey IS NOT NULL
  RETURNING *

I have this:
  const fiveMinutesAgo = new Date(Date.now() - 5 * 60 * 1000).toISOString()
  const { data: notifications, error: notificationsError } = await supabase
    .from('notifications')
    .update({ processingAt: new Date().toISOString() })
    .is('deliveredAt', null)
    .not('subscriberKey', 'is', null)
    .or(`processingAt.is.null,processingAt.lt.${fiveMinutesAgo}`)
    .select()
  const fiveMinutesAgo = new Date(Date.now() - 5 * 60 * 1000).toISOString()
  const { data: notifications, error: notificationsError } = await supabase
    .from('notifications')
    .update({ processingAt: new Date().toISOString() })
    .is('deliveredAt', null)
    .not('subscriberKey', 'is', null)
    .or(`processingAt.is.null,processingAt.lt.${fiveMinutesAgo}`)
    .select()


It updates the rows, but it returns 0 rows.

Is this possible to do?
Supabase banner
SupabaseJoin
Supabase gives you the tools, documentation, and community that makes managing databases, authentication, and backend infrastructure a lot less overwhelming.
45,816Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

Is it possible to use an existing database ?
SupabaseSSupabase / help-and-questions
4y ago
Is it possible to "and" inside an "or" method in JS client?
SupabaseSSupabase / help-and-questions
3y ago
Is it possible to change use role to be an admin?
SupabaseSSupabase / help-and-questions
4y ago
Is it possible to use spatial queries in supabase-js?
SupabaseSSupabase / help-and-questions
13mo ago