Is it possible to provide multiple unique indexes to conflict_target in activerecord-import on_duplicate_key_update option for Postgres in Rails?

479 views Asked by At

I have a unique constraint on two columns, one being the primary key and also have a unique index on another column. When I use import method, I can only define one conflict_target as far as I know. Is this true? If not, is there a way I can define multiple conflict_target for the same Import command so when I upsert a record, it does not raise exception but checks for both indexes for ON CONFLICT DO UPDATE call using activerecord-import gem

1

There are 1 answers

0
Laurenz Albe On BEST ANSWER

There can be only one conflict target, except for DO NOTHING, where you need not specify a conflict target.