Search Postgresql Archives

Re: Trigger problems/questions

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 





On Thu, Jun 15, 2017 at 1:44 PM, Adrian Klaver <adrian.klaver@xxxxxxxxxxx> 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

--

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]

  Powered by Linux