Return error when ORDER BY references unknown column#1073
Conversation
sgrif
left a comment
There was a problem hiding this comment.
This has no tests. I'm fairly certain there is no case where we would trigger this error where the shards would not have errored resolving the query. Can you provide an example?
|
Thanks for taking a look. I picked this up because of the existing TODOs in If these branches are effectively unreachable because query validation happens earlier, then my assumption was probably wrong. If so, I'm happy to close the PR. |
|
I'm fine with us verifying the invariant and erroring if it's not upheld. But if we expect this code path to never be hit unless there's a bug in pgdog we should have the error reflect that. We shouldn't add a new error variant that implies this is user error |
Summary
Replace the silent no-op behavior when resolving named ORDER BY columns fails.
Previously,
Buffer::sort()would silently skip sorting when anORDER BYcolumn name could not be found in the row description. This change returns an explicit error instead.Changes
Add
OrderByColumnNotFound(String)to multi-shard error handling.Make
Buffer::sort()returnResult<(), Error>.Return an error when resolving:
OrderBy::AscColumnOrderBy::DescColumnOrderBy::AscVectorL2Columnfails due to a missing column.
Propagate the error from the multi-shard execution path.
Tests
Added tests covering:
OrderByColumnNotFound.Notes
TODOcomments that indicated missing-column resolution should error instead of silently not sorting.cargo fmtwas run locally.