Skip to content

Commit a20f2d3

Browse files
Further clarification to custom expressions in index (#618)
1 parent 0c5581d commit a20f2d3

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

lib/ecto/migration.ex

+5
Original file line numberDiff line numberDiff line change
@@ -920,6 +920,11 @@ defmodule Ecto.Migration do
920920
# Create a tsvector GIN index on PostgreSQL
921921
create index("products", ["(to_tsvector('english', name))"],
922922
name: :products_name_vector, using: "GIN")
923+
924+
If the expression is a column name, it will not be quoted. This may cause issues
925+
when the column is named after a reserved word. Consider using an atom instead.
926+
For example, the name `offset` is reserved in many databases so the following
927+
could produce an error: `create index("products", ["offset"])`.
923928
"""
924929
def index(table, columns, opts \\ [])
925930

0 commit comments

Comments
 (0)