Skip to content

Commit

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

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

Test Plan: Add supported options to yb_portals

Reviewers: mihnea

Reviewed By: mihnea

Subscribers: kannan, yql

Differential Revision: https://phabricator.dev.yugabyte.com/D10372
  • Loading branch information
nocaway authored and Alex Ball committed Mar 9, 2021
1 parent 9214950 commit decfce1
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 @@ -7377,8 +7377,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 @@ -7437,8 +7435,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 @@ -7455,8 +7454,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 @@ -7465,8 +7462,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 @@ -7475,8 +7473,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 decfce1

Please sign in to comment.