Postgres wire protocol: add copy command#74344
Conversation
7891749 to
2b8d161
Compare
|
This is an automated comment for commit f701035 with description of existing statuses. It's updated for the latest CI running ❌ Click here to open a full report in a separate page
Successful checks
|
|
@kssenii can you please review this MR? failed tests are not relevant to my changes |
|
@scanhex12 Thanks for the PR. Please help the reviewers a bit: What does this PR implement, how does it implement it (in particular is it modeled after some spec document or information), what are implications (e.g. in terms of backward compatibility, documentation, required tests, etc.)? Please be as verbose as possible. Sorry for asking, there are zero comments in the code, no information in the PR message and the Git commit history is list of "fix" commits. |
|
@scanhex12 thanks for your contribution. After all the effort with the source code, please don't forget to address what Robert asked at #74344 (comment) to help us conduct the review. Seems there are a couple of conflicts you'll need to resolve as well. |
|
@pamarcos Sorry for the delay in the review, I rebased the branch and wrote a couple of comments in the code, I hope it’s clearer. If not, let me know, I'll try to describe it in more detail. |
No worries. I think Robert's ask and my own was that we're missing a proper description on the PR itself, not comments on the code. Please check out Robert's comment 🙏 |
|
Dear @pamarcos, this PR hasn't been updated for a while. You will be unassigned. Will you continue working on it? If so, please feel free to reassign yourself. |
|
Workflow [PR], commit [9cf66c5] Summary: ⏳
|
GrigoryPervakov
left a comment
There was a problem hiding this comment.
Overall LGTM
I've also noticed in the documentation that during the COPY FROM query, a client is allowed to send a batch in the middle of the row. It can break in such a case.
But for now, we can just leave a notice about that and fix it later if needed
| String columns_to_insert; | ||
| if (!copy_query->column_names.empty()) | ||
| { | ||
| for (const auto & column_name : copy_query->column_names) |
There was a problem hiding this comment.
nit: could use boost::algorithm::join(copy_query->column_names, ", ");
| format_ptr->flush(); | ||
| output_buffer.finalize(); | ||
| message_transport->send(PostgreSQLProtocol::Messaging::CopyOutData(std::move(result_buf))); | ||
| message_transport->send(PostgreSQLProtocol::Messaging::CopyOutData(result_buf)); |
There was a problem hiding this comment.
Maybe it's better to move it and then explicitly initialize it after.
Extra empty vector allocation looks better than a full buffer copy before send
04304c3
|
@scanhex12 Kindly add a proper changelog message to the PR, thanks. |
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes to CHANGELOG.md):
PostgreSQL protocol
COPYcommand supportDocumentation entry for user-facing changes
CI Settings (Only check the boxes if you know what you are doing)
All builds in Builds_1 and Builds_2 stages are always mandatory
and will run independently of the checks below: