How can I swap two values from particular column in a table in Postgres?
update the_table
   set name = case id
                 when 1 then (select name from the_table where id = 2)
                 when 2 then (select name from the_table where id = 1)
              end
where id in (1,2);


This assumes that id is unique (e.g. the primary key)