Re: Determining if a table really changed in a trigger

Поиск
Список
Период
Сортировка
От David G. Johnston
Тема Re: Determining if a table really changed in a trigger
Дата
Msg-id CAKFQuwb+iOAkzhCRnGZcVdC0yQZ1FQVWBuxupRgQna2d9yAuBw@mail.gmail.com
обсуждение исходный текст
Ответ на Determining if a table really changed in a trigger  (Mitar <mmitar@gmail.com>)
Список pgsql-general
On Tue, Oct 26, 2021 at 12:05 AM Mitar <mmitar@gmail.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.

В списке pgsql-general по дате отправления:

Предыдущее
От: E-BLOKOS
Дата:
Сообщение: Re: ZFS filesystem - supported ?
Следующее
От: "David G. Johnston"
Дата:
Сообщение: Re: How to copy rows into same table efficiently