Skip to content

Commit

Permalink
pgcopy: match error messages to postgres
Browse files Browse the repository at this point in the history
  • Loading branch information
maddyblue committed Feb 15, 2022
1 parent 4ed5f6a commit 84b22f4
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/pgcopy/src/copy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -433,7 +433,7 @@ impl<'a> TryFrom<CopyParams> for CopyTextFormatParams<'a> {
) -> Result<(), CopyErrorNotSupportedResponse> {
match option {
Some(..) => Err(CopyErrorNotSupportedResponse::new(format!(
"COPY {} only available in CSV mode",
"COPY {} available only in CSV mode",
param
))),
None => Ok(()),
Expand All @@ -443,7 +443,7 @@ impl<'a> TryFrom<CopyParams> for CopyTextFormatParams<'a> {
assert_eq!(format, CopyFormat::Text);
only_available_with_csv(quote, "quote")?;
only_available_with_csv(escape, "escape")?;
only_available_with_csv(header, "header")?;
only_available_with_csv(header, "HEADER")?;
let null = match null {
Some(null) => Cow::from(null),
None => Cow::from("\\N"),
Expand Down
6 changes: 3 additions & 3 deletions test/pgtest/copy-from-2.pt
Original file line number Diff line number Diff line change
Expand Up @@ -350,9 +350,9 @@ ReadyForQuery
ErrorResponse
ReadyForQuery
----
ErrorResponse {"fields":[{"typ":"C","value":"0A000"},{"typ":"M","value":"COPY quote only available in CSV mode"}]}
ErrorResponse {"fields":[{"typ":"C","value":"0A000"},{"typ":"M","value":"COPY quote available only in CSV mode"}]}
ReadyForQuery {"status":"I"}
ErrorResponse {"fields":[{"typ":"C","value":"0A000"},{"typ":"M","value":"COPY escape only available in CSV mode"}]}
ErrorResponse {"fields":[{"typ":"C","value":"0A000"},{"typ":"M","value":"COPY escape available only in CSV mode"}]}
ReadyForQuery {"status":"I"}
ErrorResponse {"fields":[{"typ":"C","value":"0A000"},{"typ":"M","value":"COPY header only available in CSV mode"}]}
ErrorResponse {"fields":[{"typ":"C","value":"0A000"},{"typ":"M","value":"COPY HEADER available only in CSV mode"}]}
ReadyForQuery {"status":"I"}

0 comments on commit 84b22f4

Please sign in to comment.