Skip to main content
1 of 2
user606521
  • 1.4k
  • 6
  • 23
  • 28

Multiple on conflict targets

I have two unique indexes on columns a and b. I need something like this:

insert into my_table (a, b) values (1, 2), (1, 2) on conflict (a) do update set c = 'a_violation' on conflict (b) do update set c = 'b_violation' 

So generally I want to make different update based on conflict target - syntax above is not supported (only one on conflict statement is supported). Is there any other way to do this?

user606521
  • 1.4k
  • 6
  • 23
  • 28