Simon Riggs <si...@2ndquadrant.com> wrote: > On 9 June 2013 12:58, Craig Ringer <cr...@2ndquadrant.com> wrote:
>> We don't currently have OLD and NEW relations so we're free to >> define how this works pretty freely. > I think the best way, if we did do this, would be to have a > number of different relations defined: > > OLD > NEW > INSERTED > DELETED > all of which would be defined same as main table > > and also one called > UPDATED > which would have two row vars called OLD and NEW > so you would access it like e.g. IF UPDATED.OLD.id = 7 Well, there is the SQL standard, which has a couple paragraphs on the topic which we might want to heed. For a delete there is just an old table; for an insert just a new one. For an update you have both, with the same cardinality. The rows in the old and new tables have a correspondence, but that is only visible to FOR EACH ROW triggers. For something like RI, why would you need to establish correspondence? A row with the referenced key either exists after the statement completes, or it doesn't -- why would we care whether it is an updated version of the same row? Syntax for how to refer to the these is defined by the standard. As usual, I don't object to adding capabilities as long as the standard syntax is also supported with standard semantics. -- Kevin Grittner EnterpriseDB: http://www.enterprisedb.com The Enterprise PostgreSQL Company -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers