How to UPDATE in ROW-style?
От
Dmitry Koterov
Тема
How to UPDATE in ROW-style?
Дата
Msg-id
d7df81620806200526g7ab62bafgdf074823d449c953@mail.gmail.com
Список
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.
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 по дате отправления