Add support for LIMIT and OFFSET

Description

Add support for LIMIT and OFFSET alongside with TOP.
See and https://discourse.openehr.org/t/aql-issue-7c-specification-for-limit-offset-keywords/306

Activity

Show:
Pieter Bos
January 11, 2021, 7:06 PM

Probably because it’s the row offset, meaning as in displacement, expressed in number or rows from the start of the result, and not the row number?

Matija Polajnar
January 13, 2021, 8:55 PM

Our implementation interprets “offset” as the number of rows skipped. Therefore “OFFSET 0 LIMIT 10” and “OFFSET 10 LIMIT 10” return the first 10 rows and the second 10 rows (i.e. 11-20) respectively. I consider that logical. Thomas, I do not fully understand your position: do you believe the phrasing is weird, but it consistent with common sense and our implementation, or some other combination between those 3 situations?

Thomas Beale
January 13, 2021, 9:04 PM

There is this para in the text:

“The LIMIT row_count OFFSET offset is used to get results in a paginated way. For instance, when offset = 0 and row_count = 10, the result will have at most 10 items, starting with item 0. Then with offset = 10 and row_count = 10, the result will contain 10 items at most, now from item 10 to 19. So increasing offset by row_count, allows to get all the results in a paginated way.“

Here, the first item is designated as the 0-th item, meaning that LIMIT 10 obtains rows 0-9 - which I find strange. Why wouldn’t it be 1 - 10?

Matija Polajnar
January 14, 2021, 8:12 AM

I agree, within the text, the first item should be “item 1”.

Sebastian Iancu
January 17, 2021, 2:36 PM

ok, agree and fixed the text. hopefully is not better and clear.

Reporter

Sebastian Iancu

Components

Affects versions

Configure