Re: [GENERAL] Trigger problems/questions

Поиск
Список
Период
Сортировка
От Jim Fulton
Тема Re: [GENERAL] Trigger problems/questions
Дата
Msg-id CAPDm-FgNP7=xSs7eTw760GonBO7ABzULEP+Ps6hNBON_vhUj5A@mail.gmail.com
обсуждение исходный текст
Ответ на Re: [GENERAL] Trigger problems/questions  (Adrian Klaver <adrian.klaver@aklaver.com>)
Список pgsql-general


On Thu, Jun 15, 2017 at 1:44 PM, Adrian Klaver <adrian.klaver@aklaver.com> wrote:
On 06/15/2017 10:23 AM, Jim Fulton wrote:

...
 
I do not pretend to fully understand what the the triggers/functions are really doing,
but I did notice this:

create or replace function populate_community_zoid_triggerf()

...

new_zoid := NEW.state ->> 'community_zoid';
zoid := find_community_zoid(
            NEW.zoid, NEW.class_name, NEW.state)::text;
if zoid is null then
    if new_zoid is not null then
    NEW.state := NEW.state - 'community_zoid';
    end if;
else
    if new_zoid is null or zoid != new_zoid then
    NEW.state :=
        NEW.state || ('{"community_zoid": ' || zoid || '}')::jsonb;
    end if;
end if;

...


Not sure what happens if zoid is null and new_zoid is null also?

Then then no change is needed and nothing happens, which is correct.
 
Or if it matters?

Nope.

Thanks for looking.

Jim

--

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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: [GENERAL] Trigger problems/questions
Следующее
От: Jim Fulton
Дата:
Сообщение: Re: [GENERAL] Trigger problems/questions