Skip to content

Commit

Permalink
fix escaping characters for psql
Browse files Browse the repository at this point in the history
double quotes(") need to be escaped in the parsed text for COPY FROM to work
properly. current implementation had an issue as it's only escaping `"` if the
string contains `\` otherwise not. This test was resulting in failure of COPY
FROM statements with `"` with no `\`.
  • Loading branch information
kaychaks committed Apr 3, 2017
1 parent c09dce2 commit af1ae6b
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ class DocumentParser(props: Properties) {
if (x.contains("\\"))
"\"" + x.replace("\\", "\\\\\\\\").replace("\"", "\\\\\"") + "\""
else
"\"" + x + "\""
"\"" + x.replace("\"", "\\\\\"") + "\""
).mkString("{", ",", "}")
}

Expand Down

0 comments on commit af1ae6b

Please sign in to comment.