Displaying 1 result from an estimated 1 matches for "insert_sharing".
2015 Jul 24
0
possible patch for ACL SQL ERROR: duplicate key value violates unique constraint "user_shares_pkey"
...from the INSERT of the function itself, hence, breaking the
recursive triggers. This assumes that dummy is never NULL from Dovecot.
The same applies to anyone_shares, just remove the to_user field from the
function.
Does somebody see something wrong with my hack?
=============
CREATE FUNCTION insert_sharing() RETURNS trigger
LANGUAGE plpgsql
AS $$
BEGIN
IF NEW.dummy IS NULL THEN
-- ugly kludge: we came here from this function, really do try to insert
return NEW;
END IF;
LOOP
UPDATE user_shares SET dummy = NEW.dummy
WHERE from_user = NEW.from_user AND to_user =...