How to UPDATE in ROW-style? - Mailing list pgsql-general

From Dmitry Koterov
Subject How to UPDATE in ROW-style?
Date
Msg-id d7df81620806200526g7ab62bafgdf074823d449c953@mail.gmail.com
Whole thread Raw
List 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.

pgsql-general by date:

Previous
From: Steve Clark
Date:
Subject: Re: renumber table
Next
From: "Kynn Jones"
Date:
Subject: Re: Easiest way to copy table from one db to another?