The TO_JSON() function is not honoring the LIMIT clause. It’s enforcing the where clause fine, but I have to nest a query to enforce the Limit Clause. Similar to the issue with LIMIT in procedures when not using dynamic sql.
select
*
FROM search_results
where search_id = 2175
limit 2
—yields 2 records—
vs
select
concat(’[’,group_concat(TO_JSON(search_results.*)),’]’) as Details
FROM search_results
where search_id = 2175
limit 2;
—yields all records—
This is the workaround for now: