also sprach martin f krafft <madd...@debian.org> [2015-11-12 17:20 +1300]:
> The only way to fix this is by using OLD in the trigger, which
> requires a separate trigger function for UPDATE than INSERT (as
> INSERT queries don't make OLD available).

I think a possible solution would be the following at the top of the
trigger function:

     IF TG_OP='UPDATE' AND NEW.gid=OLD.gid AND NEW.is_primary=OLD.is_primary 
THEN
         RETURN NEW;
     END IF;

Btw, this still does not protect against the case when an UPDATE
removes the only primary domain, making them all secondary.

If you give an indication, I can rewrite the whole function to
accomodate for that too.

-- 
 .''`.   martin f. krafft <madduck@d.o> @martinkrafft
: :'  :  proud Debian developer
`. `'`   http://people.debian.org/~madduck
  `-  Debian - when you have better things to do than fixing systems

Attachment: digital_signature_gpg.asc
Description: Digital signature (see http://martin-krafft.net/gpg/sig-policy/999bbcc4/current)

Reply via email to