IF ROW( NEW ) <> ROW( OLD )
Is it possible to "cast" a table type to a ROW so that Row-Wise
comparison can be achieved?
--
Regards,
Richard Broersma Jr.
Visit the Los Angles PostgreSQL Users Group (LAPUG)
http://pugs.postgresql.org/lapug
On Wed, Jun 25, 2008 at 4:40 PM, Joshua D. Drake <jd@commandprompt.com> wrote:
I have never tried it but you may be able to do it with a composite
type.
True. However, I was under the impression that table types were
essentially composite types. So I thought that composite types would
behave the same.
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.
--
Regards,
Richard Broersma Jr.
Visit the Los Angles PostgreSQL Users Group (LAPUG)
http://pugs.postgresql.org/lapug
Import Notes
Reply to msg id not found: 1214437227.28228.99.camel@jd-laptop
"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
On Wed, Jun 25, 2008 at 8:17 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
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.
Thanks that worked!
--
Regards,
Richard Broersma Jr.
Visit the Los Angles PostgreSQL Users Group (LAPUG)
http://pugs.postgresql.org/lapug