Upsert on conflict primary key

  Kiến thức lập trình

I have this:

ON CONFLICT (cq_pk) DO UPDATE

SET

    count_1 = count_1_old

cq_pk is the name of a primary key. I keep getting an error message “cq_pk is not a column”.

How do I do on conflict based on the name of a primary key instead of just a column list in case we ever change the primary key?

LEAVE A COMMENT