Skip to content

Postgres copy_in_raw leaves the connection in a corrupted state when the initial copy query returns an error #3699

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

Closed
lovasoa opened this issue Jan 24, 2025 · 1 comment · Fixed by #3715
Labels

Comments

@lovasoa
Copy link
Contributor

lovasoa commented Jan 24, 2025

I have found these related issues/pull requests

Not reported before

Description

conn.copy_in_raw("COPY nonexistent_table (id) FROM STDIN WITH (FORMAT CSV, HEADER)").await

returns an error, but leaves the connection conn opened in a broken state with no way to abort the ongoing COPY operation.

Initially reported here: sqlpage/SQLPage#788
Fixed here in sqlx-oldapi : sqlpage@0310a7b

Reproduction steps

conn.copy_in_raw("COPY nonexistent_table (id) FROM STDIN WITH (FORMAT CSV, HEADER)").await

SQLx version

latest

Enabled SQLx features

postgres

Database server and version

any postgres

Operating system

any

Rust version

any

@joeydewaal
Copy link
Contributor

I tried reproducing this issue but it looks like it was already fixed.

The regression tests from your pr pass in all versions from 0.7.0 and above (older versions do error). I opened #3715 that adds the regression tests from your PR so the issue can't come back.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants