Tim Tim - 6 months ago 69
SQL Question

Update whole row in PostgreSQL

I need to update a whole row without knowing the columns and rows...

Something like this:

UPDATE blabla SET blabla.* = tmp.* FROM tmp WHERE id = someid;

Has anyone ideas??

Thanks for answers


I don't think Postgres allows this. One simple solution is two separate steps:

delete from blabla where id = someid;

insert into blabla
    select * from tmp where id = someid;

This assumes that the columns are defined in the same order.