Update with distinct on violates unique key in postgres? update schema.current_status a
set status       = stat.overall_status,
    created_date = stat.created_date,
    parent_id    = stat.parent_id,
    id  = stat.id
from (select distinct on (id) id,  parent_id, overall_status, created_date
from schema.daily
where parent_id
          =
      'abc'
     ) stat;

This is the query I am using, when I run just the sub query, I can see it is returning unique records only, but when I try to update the table, it says it violates unique key. My unique key is on parent_id, id
As Akina hinted at, without a relational predicate between your subquery and the outer parent query, this is going to try to UPDATE all rows in your schema.current_status table to the same value from your schema.daily table, violating the unique key constraint. This would only work if there was only a single record in your schema.current_status table. What is the relationship between schema.current_status and schema.daily?...as that's what you're currently missing in a predicate clause (such as a WHERE clause).