-
Notifications
You must be signed in to change notification settings - Fork 567
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
Support for pg ADD GENERATED in ALTER COLUMN statements #1079
Conversation
7a34cd5
to
c687df4
Compare
@alamb Working on the broken test ... not happening locally. |
Signed-off-by: Toby Hede <toby@cipherstash.com>
c687df4
to
c672b47
Compare
Actually. PEBKAC. As always 🤦 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the contribution @tobyhede -- this looks almost good to me with the exception of some of the error handling, as I have pointed out above
src/parser/mod.rs
Outdated
None | ||
}; | ||
|
||
let _ = self.expect_keywords(&[Keyword::AS, Keyword::IDENTITY]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this ignoring the result? shouldn't it at least check and return the error, like:
let _ = self.expect_keywords(&[Keyword::AS, Keyword::IDENTITY]); | |
self.expect_keywords(&[Keyword::AS, Keyword::IDENTITY])?; |
src/parser/mod.rs
Outdated
|
||
if self.peek_token().token == Token::LParen { | ||
self.expect_token(&Token::LParen)?; | ||
sequence_options = self.parse_create_sequence_options().ok(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Likewise here, I don't understand why the error is ignored. If there is a reason maybe we can add a comment.
I also wonder if we are sure that if parse_create_sequence_options
returns an error that it hasn't consumed any tokens
); | ||
|
||
pg_and_generic().verified_stmt("ALTER TABLE t ALTER COLUMN id ADD GENERATED AS IDENTITY ( )"); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Given there is some seemingly non trival error handling, can you please add some tests that hit the errors (e.g. when the two statements I identified above actually return an error?)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On it
Signed-off-by: Toby Hede <toby@cipherstash.com>
5efe2a0
to
28ef192
Compare
Pull Request Test Coverage Report for Build 7380471401
💛 - Coveralls |
@alamb Added the missed errors, and added tests to cover the cases. Sorry for missing such basics. |
No worries at all -- thank you for your continued contributions! |
ADD GENERATED { ALWAYS | BY DEFAULT } AS IDENTITY [ ( sequence_options ) ]
Includes the identity/sequence options
Fixes #988