diff options
| author | Alvaro Herrera | 2020-05-18 23:28:46 +0000 |
|---|---|---|
| committer | Alvaro Herrera | 2020-05-18 23:28:46 +0000 |
| commit | c301c2e739c642199f9e4c62d867dc7bd5ef0fd1 (patch) | |
| tree | 78a4988942bc7ede38fc31984dcc3349c5e78a6b /src/backend/parser | |
| parent | 7966b7980138ebcee7ae986ebcc393aea38a35c0 (diff) | |
WITH TIES: number of rows is optional and defaults to one
FETCH FIRST .. ONLY implements this correctly, but we missed to include
it for FETCH FIRST .. WITH TIES in commit 357889eb17bb.
Author: Vik Fearing
Discussion: https://postgr.es/m/6aa690ef-551d-e24f-2690-c38c2442947c@postgresfriends.org
Diffstat (limited to 'src/backend/parser')
| -rw-r--r-- | src/backend/parser/gram.y | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/backend/parser/gram.y b/src/backend/parser/gram.y index 3c78f2d1b51..a24b30f06f1 100644 --- a/src/backend/parser/gram.y +++ b/src/backend/parser/gram.y @@ -11816,6 +11816,14 @@ limit_clause: n->limitOption = LIMIT_OPTION_COUNT; $$ = n; } + | FETCH first_or_next row_or_rows WITH TIES + { + SelectLimit *n = (SelectLimit *) palloc(sizeof(SelectLimit)); + n->limitOffset = NULL; + n->limitCount = makeIntConst(1, -1); + n->limitOption = LIMIT_OPTION_WITH_TIES; + $$ = n; + } ; offset_clause: |
