LP#
1847805: PCRUD can miss valid rows in LIMIT/OFFSET queries
Because we check authz for rows retrieved by open-ils.pcrud calls after
the underlying query is executed, including any limit/offset-based
paging, we can fail to return results when the first "page" is full of
rows that the calling user cannot see.
With this commit, we switch to SQL cursors and page through results in
the application logic, which guarantees that the situation above will
not impact legitimate row visibility.
Additionally, this may prove to increase speed of some queries,
especially because Postgres has the option to optimize for "fast-start"
plans.
There is a small amount over overhead added to single-row retrieval
requests, on the order of 0.25ms-0.5ms total for cursor declaration and
then cursor closing.
Signed-off-by: Mike Rylander <mrylander@gmail.com>