-
Notifications
You must be signed in to change notification settings - Fork 603
Support ?-based jsonb operators in Postgres #1242
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
Conversation
Pull Request Test Coverage Report for Build 8901370315Details
💛 - Coveralls |
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 @ReppCodes - this looks great. I think we need a few more tests but otherwise 👨🍳 👌
Note @jmhain made some significant changes to how json access is represented in #1215
I think we should merge that PR first and then this PR
@@ -2358,6 +2358,51 @@ fn test_json() { | |||
}, | |||
select.selection.unwrap(), | |||
); | |||
|
|||
let sql = r#"SELECT info FROM orders WHERE info ? 'b'"#; |
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.
Can we please add coverage for all new operators that were added?
Perhaps just verifying that they roundtrip ( no need to reverify the parsed structure for all of them), perhaps using one_statement_parses_to
or something similar
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.
@alamb The tests at lines 2373 and at 2390 should cover the other of the three new operators added, I believe? Sorry, not sure what I'm missing here.
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.
Also, I'm cleaning up the conflicts after getting that refactor merged in. Should be up shortly.
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.
And done. Assuming the three added tests hit the operators as needed, should be good to go. Just let me know!
Thanks!
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.
Yup --- looks good to me. Thank you (I think it was unclear to me that only three new operators got added initially). Sorry for my confusion
We already support most postgres jsonb operators, but were missing the ?-based ones. This commit adds support for them in both the tokenizer and the AST enums. This is simplified in the tokenizer with a dialect-specific carve-out, since Postgres thankfully does not also use ? for anonymous prepared statement parameters.
0b2dc76
to
42f68dc
Compare
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 @ReppCodes -- looks like a very nice contribution to me 🙏
@@ -2358,6 +2358,51 @@ fn test_json() { | |||
}, | |||
select.selection.unwrap(), | |||
); | |||
|
|||
let sql = r#"SELECT info FROM orders WHERE info ? 'b'"#; |
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.
Yup --- looks good to me. Thank you (I think it was unclear to me that only three new operators got added initially). Sorry for my confusion
Co-authored-by: Andrew Repp <[email protected]>
We already support most postgres jsonb operators, but were missing the ?-based ones. This commit adds support for them in both the tokenizer and the AST enums. This is simplified in the tokenizer with a dialect-specific carve-out, since Postgres thankfully does not also use ? for anonymous prepared statement parameters.
This resolves #1236