I'm quite new to PostgreSQL and have spend too much time already to try to find an example to adapt for what i want to do. So I hope I can get some help here
I have 2 tables, call them person and address
I want to create a trigger that copy street and house_nr from table Address when I insert a new value for person_id in the first table where person_id = oid
Table person
person_id
street
house_nr
other_attributesTable Address
oid
street
house_nr
other_attributes
Something like this
INSERT INTO person
set person.street = address.street,
person.house_nr = address.house_nr
FROM address
WHERE person_id = oid
Hope someone will have time to help cheers