Skip to content

Commit

Permalink
[BACKPORT to 2.4] [#6749] YSQL: Add support for FETCH NEXT, FORWARD, …
Browse files Browse the repository at this point in the history
…and positive row-count options

Summary: Turn ON options NEXT, FORWARD, and positive row-count

Test Plan: Jenkins: rebase: 2.4

Reviewers: mihnea

Reviewed By: mihnea

Subscribers: yql, kannan

Differential Revision: https://phabricator.dev.yugabyte.com/D10376
  • Loading branch information
nocaway committed Jan 16, 2021
1 parent 1c6d4aa commit 0f567b0
Show file tree
Hide file tree
Showing 4 changed files with 641 additions and 173 deletions.
16 changes: 6 additions & 10 deletions src/postgres/src/backend/parser/gram.y
Original file line number Diff line number Diff line change
Expand Up @@ -7369,8 +7369,6 @@ fetch_args: cursor_name
}
| NEXT opt_from_in cursor_name
{
parser_ybc_signal_unsupported(@1, "FETCH NEXT", 6514);

FetchStmt *n = makeNode(FetchStmt);
n->portalname = $3;
n->direction = FETCH_FORWARD;
Expand Down Expand Up @@ -7429,8 +7427,9 @@ fetch_args: cursor_name
}
| SignedIconst opt_from_in cursor_name
{
parser_ybc_signal_unsupported(@1, "FETCH + OR -", 6514);

if ($1 < 0) {
parser_ybc_signal_unsupported(@1, "FETCH -", 6514);
}
FetchStmt *n = makeNode(FetchStmt);
n->portalname = $3;
n->direction = FETCH_FORWARD;
Expand All @@ -7447,8 +7446,6 @@ fetch_args: cursor_name
}
| FORWARD opt_from_in cursor_name
{
parser_ybc_signal_unsupported(@1, "FETCH FORWARD", 6514);

FetchStmt *n = makeNode(FetchStmt);
n->portalname = $3;
n->direction = FETCH_FORWARD;
Expand All @@ -7457,8 +7454,9 @@ fetch_args: cursor_name
}
| FORWARD SignedIconst opt_from_in cursor_name
{
parser_ybc_signal_unsupported(@1, "FETCH FORWARD", 6514);

if ($2 < 0) {
parser_ybc_signal_unsupported(@1, "FETCH FORWARD -", 6514);
}
FetchStmt *n = makeNode(FetchStmt);
n->portalname = $4;
n->direction = FETCH_FORWARD;
Expand All @@ -7467,8 +7465,6 @@ fetch_args: cursor_name
}
| FORWARD ALL opt_from_in cursor_name
{
parser_ybc_signal_unsupported(@1, "FETCH FORWARD", 6514);

FetchStmt *n = makeNode(FetchStmt);
n->portalname = $4;
n->direction = FETCH_FORWARD;
Expand Down
Loading

0 comments on commit 0f567b0

Please sign in to comment.