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

builtins: add pg_sequence_last_value builtin #106445

Merged
merged 1 commit into from Jul 12, 2023

Conversation

rafiss
Copy link
Collaborator

@rafiss rafiss commented Jul 7, 2023

fixes #105957

Release note (sql change): Added the pg_sequence_last_value builtin function, which returns the last value generated by the sequence.

@rafiss rafiss requested review from a team as code owners July 7, 2023 20:52
@rafiss rafiss requested a review from michae2 July 7, 2023 20:52
@cockroach-teamcity
Copy link
Member

This change is Reviewable

Copy link
Collaborator

@michae2 michae2 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 8 of 8 files at r1, all commit messages.
Reviewable status: :shipit: complete! 1 of 0 LGTMs obtained (waiting on @rafiss)


pkg/sql/sequence.go line 371 at r1 (raw file):

	// Before using for the first time, sequenceValue will be:
	// opts.Start - opts.Increment.

Can sequences wrap around?

Copy link
Collaborator Author

@rafiss rafiss left a comment

Choose a reason for hiding this comment

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

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


pkg/sql/sequence.go line 371 at r1 (raw file):

Previously, michae2 (Michael Erickson) wrote…

Can sequences wrap around?

no, you'd get

ERROR: nextval(): reached maximum value of sequence "s"
SQLSTATE: 2200H

Release note (sql change): Added the pg_sequence_last_value builtin
function, which returns the last value generated by the sequence.
@rafiss
Copy link
Collaborator Author

rafiss commented Jul 12, 2023

tftr!

bors r=michae2

@craig
Copy link
Contributor

craig bot commented Jul 12, 2023

Build succeeded:

@craig craig bot merged commit 922c512 into cockroachdb:master Jul 12, 2023
6 of 7 checks passed
@rafiss rafiss deleted the pg_sequence_last_value branch July 12, 2023 23:35
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.

Liquibase diff fails on "unknown function: pg_sequence_last_value()"
3 participants