Search Postgresql Archives

Re: update table with suppress_redundant_updates_trigger()

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

 



Problem "solved".

"found" will be true of false depending on the trigger action.

update done -> found = true, update not done -> found=false.

But: The trigger sometimes allows updates where no data has been changed! That is another problem to be solved :(

Regards

walter

Am 25.02.19 um 19:42 schrieb wambacher@xxxxxxxxx:

Hi,

i'm doing a lot of updates in my database, but most of them are not necessary at all (sorry, just detected it)

Therefore i installed a trigger to minimize real updates.

create trigger suppress_redundant_updates_boundaries
   before update on boundaries
   for each row execute procedure suppress_redundant_updates_trigger();

Is there a way to get the count of the real table updates?

Using pl/pgsql i'm updating boundaries  with

                  update boundaries
                     set id             = bT2.id,
                         country        = bT2.country,
                         type           = 'admin',   
                         value          = bT2.value,
...
                        ,qm             = bT2.qm
                        ,lwqm           = st_area(geography(coalesce(xlandarea,rT.way)))
                   where id = bT2.id;

                   if (found) then
                      if (debug > 0) then raise notice 'real db update of % done 2', bT2.id; end if;
                      updatedDB := updatedDB + 1;
                   end if;

i get a "wrong" result, because "found" is always true, even when the records are identical (hope so) and an update should be suppressed by the trigger.

Question: will "found" be set when update has been blocked by the trigger - or does that not matter?

if "found" is always true: what else can i do?

regards

walter


[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