Code: Select all
(select foo from table)
union all
(select bar from table)
limit 10
offset 0
Code: Select all
(select foo from table)
union all
(select bar from table)
limit 10
offset 0
Code: Select all
select foo from table
union all
(select bar from table)
limit 10
offset 0
Code: Select all
(select * from patient where PatNum = 1)
union all
(select * from patient where PatNum = 2)
To me, this is a bug in the query screening logic, and is the reason I opened this issue. Sure - I have a work around for it, but the code is incorrectly flagging a valid query as non-read-only. Perhaps the code around that validation is too complex to make the change worthwhile, but it's something I stumbled into so I figured I'd provide you a test case.I stepped through the read-only query screening logic and saw that the extraneous leading parenthesis was the culprit.
Code: Select all
(
select ...
from commlog cl
join patient p on cl.PatNum = p.PatNum
where cl.Mode_ = 5
and cl.CommLogNum in (a set of ids)
limit 10
offset 0
)
union all
(
select ...
from commlog cl
join patient p on cl.PatNum = p.PatNum
where cl.Mode_ = 5
and cl.CommLogNum not in (a set of ids)
order by cl.CommDateTime desc
limit 10
offset 0
)
Code: Select all
SELECT subquery1.* FROM [subquery] as subquery1
UNION ALL
SELECT subquery2.* FROM [subquery] as subquery2