I am using Supabase as my Flutter app backend, and I've hit a problem trying to build a complex SQL query using the Flutter
Here is the query I am trying to create in SQL...
select
"instanceId","scheduled"->>'absolute',"taskOpen" from gd_task
where
("scheduled"->>'absolute' >= '2023-07-19' and "scheduled"->>'absolute' <= '2023-07-25')
or
("scheduled"->>'absolute' < '2023-07-19' AND "taskOpen" = true)
or
("scheduled"->>'absolute' < '2023-07-19' AND "taskOpen" = false AND "actualFinish" = '2023-07-19')
Building the same thing in the Flutter Supabase query classes, I end up with the following three 'or' filter being added to the query...
.or('scheduled->>absolute.gte.2023-07-19T00:00:00.000,and(scheduled->>absolute.lte.2023-07-25T23:59:59.000)')
.or('scheduled->>absolute.lt.2023-07-19T00:00:00.000,and(taskOpen.eq.true)')
.or('scheduled->>absolute.lt.2023-07-19T00:00:00.000,and(taskOpen.eq.false),and(actualFinish.eq.2023-07-19T00:00:00.000)')
... but this is not returning the correct results
In particular, the data from the 1st 'or' is not being returned
Drilling into the Supabase Flutter code, the URI ends up as...
Any suggestions?
Resolved. I had misread the Supabase/Flutter guide on how the 'or' function works, and this only became apparent once I'd read the Pgx rest api guide