Skip to content

feat(postgres): WIP implement COPY FROM/TO STDIN - #491

Closed
abonander wants to merge 1 commit into
masterfrom
ab/pg-copy
Closed

abonander wants to merge 1 commit into
masterfrom
ab/pg-copy

Conversation

@abonander

Copy link
Copy Markdown
Collaborator

closes #36

/// [in this StackOverflow answer](https://stackoverflow.com/a/35319598).
///
/// If you don't read the stream to completion, the next time the connection is used it will
/// need to read and discard all the remaining queued data, which could take some time.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I need to actually handle this.


match conn.stream.recv().await {
Ok(msg) => Err(err_protocol!(
"fail_with: expected ErrorResponse, got: {:?}",

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need to update this error message.

msg.format
)),
// FIXME: inspect the `DatabaseError` to make sure we're not discarding another error
Err(Error::Database(_db)) => Ok(()),

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We shouldn't merge until this is fixed.

conn.wait_until_ready().await?;
conn.stream.send(Query(statement)).await?;

let _: CopyResponse = conn

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if or how we want to make this available for inspection by the user.

@mehcode mehcode added this to the 0.5 milestone Jul 27, 2020
@mehcode

mehcode commented Nov 12, 2020

Copy link
Copy Markdown
Contributor

Closing to clear up the PR queue but note that @abonander is still planning to work on this in the near future.

@mehcode mehcode closed this Nov 12, 2020
@skreborn

Copy link
Copy Markdown

@abonander Sorry to bug; is there a reason this hasn't progressed further in the past year or so, or has it just not been a priority? I would greatly appreciate the inclusion of this feature for a project I'm actively working on.

@abonander
abonander deleted the ab/pg-copy branch July 11, 2022 20:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add support for COPY ... FROM STDIN and COPY ... TO STDOUT statements in PostgreSQL

3 participants