pl/pgsql trigger function - compare *most* columns in NEW vs. OLD

From: Mike Blackwell <mike(dot)blackwell(at)rrd(dot)com>
To: pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: pl/pgsql trigger function - compare *most* columns in NEW vs. OLD
Date: 2014-12-18 18:16:24
Message-ID: CANPAkgu8-Fh+=nNpPWDvjGkAZuNMA0AhpCAKOEef_Rg9db1_wA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Is there a simple notation for comparing most columns in the new and old
records in a pl/pgsql trigger function? Something like

(new.b, new.c, new.d) = (old.b, old.c, old.d)

works to compare all the columns except 'a', but is fragile in that it
needs to be updated any time a column is added to the table, and is rather
messy looking when the actual table has many columns.

Is there a better approach to detecting a change in any column except a few
specific ones?

* <Mike(dot)Blackwell(at)rrd(dot)com>*

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Adrian Klaver 2014-12-18 18:48:54 Re: SSL Certificates in Windows 7 & Postgres 9.3
Previous Message Cristian Iturrieta 2014-12-18 17:49:56 Postgresql 9.2, Memoy cache usage.