-
Notifications
You must be signed in to change notification settings - Fork 40
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
[nexus] Make 'update_and_check' CTE explicitly request columns #4572
Conversation
// TODO: don't convert to vec? You'll need to figure | ||
// out how to state the type of IntoIter. | ||
[$($column::NAME,)+].to_vec().into_iter() |
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.
I would like to turn this into the following
// TODO: don't convert to vec? You'll need to figure | |
// out how to state the type of IntoIter. | |
[$($column::NAME,)+].to_vec().into_iter() | |
[$($column::NAME,)+].into_iter() |
... but this would require changing:
type IntoIter = std::vec::IntoIter<Self::Item>;
Into:
type IntoIter = std::array::IntoIter<Self::Item, N>;
I don't know how to specify the type of "N" here, even though it should be knowable -- it's the length of $column
.
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.
I think either of the first two options in https://danielkeep.github.io/tlborm/book/blk-counting.html would be fine. A better approach would be rust-lang/rust#83527 which isn't stable yet.
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.
Actually in this case you can just pass in the length as an argument to impl_column_walker
.
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.
Ah, good call, I'll pass the length explicitly.
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.
Looks great!
Related to #4570 , but not a direct fix for it
This PR removes a usage of ".*" from a SQL query. Using ".*" in sql queries is somewhat risky -- it makes an implicit dependency on order, and can make backwards compatibility difficult in certain circumstances.
Instead, this PR provides a
ColumnWalker
, for converting a tuple of columns to an iterator, and requests the expected columns explicitly.