Re: IF ROW( NEW ) <> ROW( OLD )

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Richard Broersma" <richard(dot)broersma(at)gmail(dot)com>
Cc: "Joshua D(dot) Drake" <jd(at)commandprompt(dot)com>, "PostgreSQL - General ML" <pgsql-general(at)postgresql(dot)org>
Subject: Re: IF ROW( NEW ) <> ROW( OLD )
Date: 2008-06-26 03:17:37
Message-ID: 3818.1214450257@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

"Richard Broersma" <richard(dot)broersma(at)gmail(dot)com> writes:
> I could manually expand the composite type OLD and NEW to enumerate
> each field and make a row wise comparison. However, I was hoping to
> avoid that.

I think IF ROW(NEW.*) <> ROW(OLD.*) will work in recent releases.

Actually you'd better use IF ROW(NEW.*) IS DISTINCT FROM ROW(OLD.*) ...
you really don't want to rely on <> as it will not give the behavior
you want in the presence of null columns.

regards, tom lane

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2008-06-26 03:32:07 Re: ERROR: could not open relation with OID 2836
Previous Message Robert Treat 2008-06-26 03:07:17 Re: limits?