Skip to content

Commit 807246c

Browse files
committed
Be consistent across adapters
1 parent a23bf03 commit 807246c

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

lib/ecto/adapters/myxql/connection.ex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -456,7 +456,7 @@ if Code.ensure_loaded?(MyXQL) do
456456
defp operator_to_boolean(:or), do: " OR "
457457

458458
defp parens_for_select([first_expr | _] = expr) do
459-
if is_binary(first_expr) and String.starts_with?(first_expr, ["SELECT", "select"]) do
459+
if is_binary(first_expr) and String.match?(first_expr, ~r/^\s*select/i) do
460460
[?(, expr, ?)]
461461
else
462462
expr

lib/ecto/adapters/postgres/connection.ex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -546,7 +546,7 @@ if Code.ensure_loaded?(Postgrex) do
546546
defp operator_to_boolean(:or), do: " OR "
547547

548548
defp parens_for_select([first_expr | _] = expr) do
549-
if is_binary(first_expr) and String.starts_with?(first_expr, ["SELECT", "select"]) do
549+
if is_binary(first_expr) and String.match?(first_expr, ~r/^\s*select/i) do
550550
[?(, expr, ?)]
551551
else
552552
expr

0 commit comments

Comments
 (0)