search for: mergequota2

Displaying 2 results from an estimated 2 matches for "mergequota2".

Did you mean: mergequota
2011 Dec 15
1
Quota PostgreSQL INSERT trigger
...IF NEW.messages = 0 THEN RETURN NEW; ELSE NEW.messages = - NEW.messages; RETURN NEW; END IF; EXCEPTION WHEN unique_violation THEN -- someone just inserted the record, update it END; END LOOP; END; $$ LANGUAGE plpgsql; DROP TRIGGER IF EXISTS mergequota2 ON quota2; CREATE TRIGGER mergequota2 BEFORE INSERT ON quota2 FOR EACH ROW EXECUTE PROCEDURE merge_quota2(); --- Best regards, Adis
2019 Sep 03
0
Quota count and clone questions
Hi, I presume you figured this out after all this time, but in any case. Since quota_clone is not cumulative, it always inserts new record with actual quota, to be able to get correct results in postfixadmin one must: DROP TRIGGER mergequota2 ON quota2; And to prevent ERROR: duplicate key value violates unique constraint "quota2_pkey": CREATE FUNCTION public.clone_quota2() RETURNS trigger LANGUAGE plpgsql AS $$ BEGIN UPDATE quota2 SET bytes = NEW.bytes, messages = NEW.messages...