Skip to content

Commit

Permalink
Implements hints for Postgresql
Browse files Browse the repository at this point in the history
  • Loading branch information
hissssst committed Jun 22, 2023
1 parent d0ece94 commit b0efd4d
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions lib/ecto/adapters/postgres/connection.ex
Original file line number Diff line number Diff line change
Expand Up @@ -392,13 +392,9 @@ if Code.ensure_loaded?(Postgrex) do
exprs}
end

defp from(%{from: %{hints: [_ | _]}} = query, _sources) do
error!(query, "table hints are not supported by PostgreSQL")
end

defp from(%{from: %{source: source}} = query, sources) do
defp from(%{from: %{source: source, hints: hints}} = query, sources) do
{from, name} = get_source(query, sources, 0, source)
[" FROM ", from, " AS " | name]
[" FROM ", from, " AS ", name | Enum.map(hints, &[?\s | &1])]
end

defp cte(%{with_ctes: %WithExpr{recursive: recursive, queries: [_ | _] = queries}} = query, sources) do
Expand Down

0 comments on commit b0efd4d

Please sign in to comment.