From: | "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com> |
---|---|
To: | Mitar <mmitar(at)gmail(dot)com> |
Cc: | Postgres General <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: Determining if a table really changed in a trigger |
Date: | 2021-10-26 13:17:23 |
Message-ID: | CAKFQuwb+iOAkzhCRnGZcVdC0yQZ1FQVWBuxupRgQna2d9yAuBw@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On Tue, Oct 26, 2021 at 12:05 AM Mitar <mmitar(at)gmail(dot)com> wrote:
>
> But this fails if the table contains a JSON field with the error:
>
> could not identify an equality operator for type json
>
Thus it is not possible to use whole row comparisons. You will need to
write the code to manually check equality on each column. To check the
json column you will probably want to cast to jsonb (if it isn't already)
and then cast that to text and use a text equality check. Since you are
doing a statement trigger that means writing "SELECT col1, col2, etc...".
> The table has an unique index column, if that helps.
>
>
That would be assumed since you need to be able to identify records whose
contents might otherwise be identical.
David J.
From | Date | Subject | |
---|---|---|---|
Next Message | David G. Johnston | 2021-10-26 13:23:55 | Re: How to copy rows into same table efficiently |
Previous Message | E-BLOKOS | 2021-10-26 11:05:52 | Re: ZFS filesystem - supported ? |