-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
74006: sql: add support for DECLARE, FETCH, CLOSE CURSOR using internal executors r=jordanlewis a=jordanlewis Touches #41412. This PR implements the SQL CURSOR methods DECLARE, FETCH and CLOSE using streaming internal executors. Here's the Postgres docs on DECLARE: https://www.postgresql.org/docs/current/sql-declare.html Things it implements: - DECLARE for forward-only cursors - FETCH forward, relative, and absolute variants for forward-only cursors - CLOSE a cursor - pg_catalog.pg_cursors Things it's missing: - BINARY CURSOR support, which returns data in the Postgres binary format - MOVE support, which allows advancing the cursor without returning any rows. This should be quite similar to FETCH. - WITH HOLD support (allows keeping a cursor open for longer than a transaction by writing its results into a buffer) - Scrollable cursor (reverse fetch) support, we'd have to implement this also by savings results into a buffer. - FOR UPDATE support - Respect for `SAVEPOINT`. Cursor definitions will not disappear if rolled back to a savepoint before they were created. But we also don't do this right for settings (see #69396) so I don't think this is a major problem. Co-authored-by: Jordan Lewis <[email protected]>
- Loading branch information
Showing
30 changed files
with
1,778 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
close_cursor_stmt ::= | ||
'CLOSE' 'ALL' | ||
| 'CLOSE' cursor_name |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
declare_cursor_stmt ::= | ||
'DECLARE' cursor_name opt_binary opt_sensitivity opt_scroll 'CURSOR' opt_hold 'FOR' select_stmt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
fetch_cursor_stmt ::= | ||
'FETCH' fetch_specifier |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.