How to UPDATE in ROW-style?

From: "Dmitry Koterov" <dmitry(at)koterov(dot)ru>
To: "Postgres General" <pgsql-general(at)postgresql(dot)org>
Subject: How to UPDATE in ROW-style?
Date: 2008-06-20 12:26:40
Message-ID: d7df81620806200526g7ab62bafgdf074823d449c953@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hello.

How could I write something like:

DECLARE r table%ROWTYPE;
...
UPDATE table SET (table.*) = (SELECT r.*) WHERE id = r.id;

*This *syntax is invalid, and I cannot find another proper way to do it
without explicit enumeration of table's columns.

I don't want to explicitly specify table's column to minimize later
refactoring.

P.S.

The corresponding INSERT operator works fine:

DECLARE r table%ROWTYPE;
...
INSERT INTO table (SELECT r.*);

Please say if a similar syntax for UPDATE exists.

Browse pgsql-general by date

  From Date Subject
Next Message Hermann Muster 2008-06-20 12:37:46 Connection to second database on server
Previous Message Steve Clark 2008-06-20 11:47:57 Re: renumber table