Re: IF ROW( NEW ) <> ROW( OLD ) - Mailing list pgsql-general

From Tom Lane
Subject Re: IF ROW( NEW ) <> ROW( OLD )
Date
Msg-id 3818.1214450257@sss.pgh.pa.us
Whole thread Raw
In response to Re: IF ROW( NEW ) <> ROW( OLD )  ("Richard Broersma" <richard.broersma@gmail.com>)
Responses Re: IF ROW( NEW ) <> ROW( OLD )  ("Richard Broersma" <richard.broersma@gmail.com>)
List pgsql-general
"Richard Broersma" <richard.broersma@gmail.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

pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: what are rules for?
Next
From: Tom Lane
Date:
Subject: Re: ERROR: could not open relation with OID 2836