Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

plpgsql: implement CLOSE statements #111330

Merged
merged 2 commits into from
Oct 4, 2023
Merged

Conversation

DrewKimball
Copy link
Collaborator

plpgsql: add builtin function for closing cursors

This patch adds the crdb_internal.plpgsql_close builtin, which closes
the cursor with the given name. It returns a 34000 error if there is
no cursor with the given name. A following commit will use this to
implement the PLpgSQL CLOSE statement.

Informs #109709

Release note: None

plpgsql: implement CLOSE statements

This patch implements the PLpgSQL CLOSE statement, which allows a
PLpgSQL routine to close a cursor with the name specified by a cursor
variable. Closing the cursor is handled by the internal builtin function
crdb_internal.plpgsql_close.

Informs #109709

Release note (sql change): Added support for the PLpgSQL CLOSE statement.

@DrewKimball
Copy link
Collaborator Author

The first two commits are #110709.

@cockroach-teamcity
Copy link
Member

This change is Reviewable

@DrewKimball DrewKimball removed request for a team and michae2 September 27, 2023 07:39
Copy link
Collaborator

@rharding6373 rharding6373 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:lgtm: Nice work!

Reviewable status: :shipit: complete! 1 of 0 LGTMs obtained (waiting on @mgartner)

@DrewKimball DrewKimball force-pushed the close-cursor branch 2 times, most recently from 856777a to 235c32a Compare October 3, 2023 17:14
Copy link
Collaborator

@mgartner mgartner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:lgtm:

Reviewed 1 of 15 files at r3, 35 of 35 files at r5, 29 of 29 files at r6, all commit messages.
Reviewable status: :shipit: complete! 1 of 0 LGTMs obtained (and 1 stale) (waiting on @DrewKimball)


pkg/sql/faketreeeval/evalctx.go line 343 at r5 (raw file):

// PLpgSQLCloseCursor is part of the eval.Planner interface.
func (*DummyEvalPlanner) PLpgSQLCloseCursor(_ tree.Name) error {
	return nil

nit: Shouldn't this return an error like some of the methods up above?

This patch adds the `crdb_internal.plpgsql_close` builtin, which closes
the cursor with the given name. It returns a `34000` error if there is
no cursor with the given name. A following commit will use this to
implement the PLpgSQL CLOSE statement.

Informs cockroachdb#109709

Release note: None
This patch implements the PLpgSQL CLOSE statement, which allows a
PLpgSQL routine to close a cursor with the name specified by a cursor
variable. Closing the cursor is handled by the internal builtin function
`crdb_internal.plpgsql_close`.

Informs cockroachdb#109709

Release note (sql change): Added support for the PLpgSQL CLOSE statement.
Copy link
Collaborator Author

@DrewKimball DrewKimball left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TFTRs!

Reviewable status: :shipit: complete! 1 of 0 LGTMs obtained (and 1 stale) (waiting on @DrewKimball)


pkg/sql/faketreeeval/evalctx.go line 343 at r5 (raw file):

Previously, mgartner (Marcus Gartner) wrote…

nit: Shouldn't this return an error like some of the methods up above?

Done.

@DrewKimball
Copy link
Collaborator Author

bors r+

@craig
Copy link
Contributor

craig bot commented Oct 4, 2023

Build succeeded:

@craig craig bot merged commit fd181dd into cockroachdb:master Oct 4, 2023
@DrewKimball DrewKimball deleted the close-cursor branch October 4, 2023 18:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants