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

sql: add a helper parser function for sequence options stored in a descriptor #83208

Closed
ZhouXing19 opened this issue Jun 22, 2022 · 2 comments · Fixed by #84034
Closed

sql: add a helper parser function for sequence options stored in a descriptor #83208

ZhouXing19 opened this issue Jun 22, 2022 · 2 comments · Fixed by #84034
Assignees
Labels
C-bug Code not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior. T-sql-foundations SQL Foundations Team (formerly SQL Schema + SQL Sessions)

Comments

@ZhouXing19
Copy link
Collaborator

ZhouXing19 commented Jun 22, 2022

Currently, the sequence options passed to a GENERATED AS IDENTITY are saved as a string in the descriptor, which makes it hard to extract the specific sequence info such as START, INCREMENT of this identity column, and hard to solve issues such as #82064. It should be saved as a dedicated type such as TableDescriptor_SequenceOpts but for ColumnDescriptor have an easy-to-use function for parsing these options.

Jira issue: CRDB-16921

@ZhouXing19 ZhouXing19 added C-bug Code not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior. T-sql-foundations SQL Foundations Team (formerly SQL Schema + SQL Sessions) labels Jun 22, 2022
@ZhouXing19 ZhouXing19 self-assigned this Jun 22, 2022
@rafiss
Copy link
Collaborator

rafiss commented Jun 22, 2022

Are we able to parse the string with the sequence opts? That doesn't sound like too much overhead to me, and we can add a function for it.

@ZhouXing19
Copy link
Collaborator Author

Actually I don't think we should get the string involved -- the ideal solution is to directly convert tree.SequenceOptions to descs.ColumnDescriptor_SequenceOpts, and we can leverage sql.assignSequenceOptions() for that.

@rafiss rafiss changed the title sql: GENERATED AS IDENTITY column's sequence option is incorrectly stored as string in the descriptor sql: add a helper parser function for sequence options stored in a descriptor Jun 27, 2022
@craig craig bot closed this as completed in 116c5aa Jul 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Code not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior. T-sql-foundations SQL Foundations Team (formerly SQL Schema + SQL Sessions)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants