On Sunday 20 November 2005 09:15 am, Andy Ballingall wrote: It works because of the way updates are done. When you do an update two versions of the row exist. The OLD version is the row as it existed before you updated. The NEW version contains the entire version with the update changes. The key thing to remember is the the NEW version contains both those fields that have changed as well as those that have not. So the UPDATE rule just passes along all the fields named in it regardless of whether they changed or not. It would be a good idea to read the following section of the manual (http://www.postgresql.org/docs/8.0/interactive/rules.html) as it explains when the rule picks up the values in the fields. This differs according to the type of rule. > >Try it. [snipped example] > > Ah. Basically, you set up the rule to assign every column, and if the > update doesn't redefine some columns, then it still works. I didn't > understand that you could get the rule to work generically like this. > > I'll presume that the rule will need amending if the table column > definition later changes. (E.g. if I add 'stalk_length' to my apples and > pears tables)... > > Thanks very much for your help. > > Andy > > > > ---------------------------(end of broadcast)--------------------------- > TIP 5: don't forget to increase your free space map settings
-- Adrian Klaver [EMAIL PROTECTED] ---------------------------(end of broadcast)--------------------------- TIP 6: explain analyze is your friend