Hello,
since it is possible to do: INSERT INTO some_table VALUES (NEW.*) in pl/pgsql can we do something similar but for UPDATE clause using NEW ? I mean i want to update some row using values from NEW object.
Thanks in advance.
Hello,
since it is possible to do: INSERT INTO some_table VALUES (NEW.*) in pl/pgsql can we do something similar but for UPDATE clause using NEW ? I mean i want to update some row using values from NEW object.
Thanks in advance.
it is possible to do what you haved mentiened.please refer to the following link:
http://www.postgresql.org/docs/current/interactive/plpgsql-trigger.html
I did not find any solution to solve my problem in http://www.postgresql.org/docs/current/interactive/plpgsql-trigger.html so I'll explain a little bit more what I want to achieve.
When I insert a new record to table "SomeTable" I want to:
Points 1 and 3 are easy to implement. However, I don't know how can I update a row using values from NEW object. The important thing is I will not know the structure of a record, that's why I can't simply do:
Update SomeTable name = New.name Where id= someId
Thats why I am looking for some more generic way to to this, something like:
update sometable set * = NEw.*