@@ -1142,14 +1142,15 @@ defmodule Ecto.Adapters.PostgresTest do
11421142 query = insert ( nil , "schema" , [ :x , :y ] , [ [ :x , :y ] ] , { [ :x , :y ] , [ ] , [ :id ] } , [ ] )
11431143 assert query == ~s{ INSERT INTO "schema" ("x","y") VALUES ($1,$2) ON CONFLICT ("id") DO UPDATE SET "x" = EXCLUDED."x","y" = EXCLUDED."y"}
11441144
1145- query = insert ( nil , "schema" , [ :x , :y ] , [ [ :x , :y ] ] , { [ :x , :y ] , [ ] , [ ] } , [ ] )
1146- assert query == ~s{ INSERT INTO "schema" ("x","y") VALUES ($1,$2) ON CONFLICT DO UPDATE SET "x" = EXCLUDED."x","y" = EXCLUDED."y"}
1147-
11481145 query = insert ( nil , "schema" , [ :x , :y ] , [ [ :x , :y ] ] , { [ :x , :y ] , [ ] , { :constraint , :foo } } , [ ] )
11491146 assert query == ~s{ INSERT INTO "schema" ("x","y") VALUES ($1,$2) ON CONFLICT ON CONSTRAINT \" foo\" DO UPDATE SET "x" = EXCLUDED."x","y" = EXCLUDED."y"}
11501147
11511148 query = insert ( nil , "schema" , [ :x , :y ] , [ [ :x , :y ] ] , { [ :x , :y ] , [ ] , { :unsafe_fragment , "(\" id\" )" } } , [ ] )
11521149 assert query == ~s{ INSERT INTO "schema" ("x","y") VALUES ($1,$2) ON CONFLICT (\" id\" ) DO UPDATE SET "x" = EXCLUDED."x","y" = EXCLUDED."y"}
1150+
1151+ assert_raise ArgumentError , "the :conflict_target option is required on upserts by PostgreSQL" , fn ->
1152+ insert ( nil , "schema" , [ :x , :y ] , [ [ :x , :y ] ] , { [ :x , :y ] , [ ] , [ ] } , [ ] )
1153+ end
11531154 end
11541155
11551156 test "insert with query" do
0 commit comments