Skip to content

Commit

Permalink
remove coment validation
Browse files Browse the repository at this point in the history
  • Loading branch information
dkuku committed Oct 23, 2024
1 parent 518ee8f commit 70fd3e3
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 13 deletions.
10 changes: 1 addition & 9 deletions lib/postgrex/protocol.ex
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,6 @@ defmodule Postgrex.Protocol do
message:
"`:commit_comment` option cannot contain sequence \"*/\""
)
@comment_validation_error Postgrex.Error.exception(
message: "`:comment` option cannot contain sequence \"*/\""
)

defstruct sock: nil,
connection_id: nil,
Expand Down Expand Up @@ -355,12 +352,7 @@ defmodule Postgrex.Protocol do

false ->
comment = Keyword.get(opts, :comment)

if is_binary(comment) && String.contains?(comment, "*/") do
raise @comment_validation_error
else
parse_describe_flush(s, status, query, comment)
end
parse_describe_flush(s, status, query, comment)
end
end

Expand Down
4 changes: 0 additions & 4 deletions test/query_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -1853,10 +1853,6 @@ defmodule QueryTest do

test "comment", context do
assert [[123]] = query("select 123", [], comment: "query comment goes here")

assert_raise Postgrex.Error, fn ->
query("select 123", [], comment: "*/ DROP TABLE 123 --")
end
end

@tag :big_binary
Expand Down

0 comments on commit 70fd3e3

Please sign in to comment.