Skip to content

Commit

Permalink
Use single_quote when possible
Browse files Browse the repository at this point in the history
  • Loading branch information
josevalim committed Oct 7, 2020
1 parent 0798542 commit 66e70d2
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/ecto/adapters/postgres/connection.ex
Original file line number Diff line number Diff line change
Expand Up @@ -1048,7 +1048,7 @@ if Code.ensure_loaded?(Postgrex) do
end
defp default_type(literal, _type) when is_binary(literal) do
if :binary.match(literal, <<0>>) == :nomatch and String.valid?(literal) do
[?', escape_string(literal), ?']
single_quote(literal)
else
encoded = "\\x" <> Base.encode16(literal, case: :lower)
raise ArgumentError, "default values are interpolated as UTF-8 strings and cannot contain null bytes. " <>
Expand Down

0 comments on commit 66e70d2

Please sign in to comment.