CREATE FUNCTION reorder_priority() RETURNS TRIGGER AS $$ BEGIN CASE TG_OP WHEN 'UPDATE' THEN UPDATE link SET priority = priority + 1 WHERE link.priority >= NEW.priority AND NOT link.priority > OLD.priority; END CASE; RETURN NULL; END; $$ LANGUAGE plpgsql;正确解法
BEGIN CASE TG_OP WHEN 'UPDATE' THEN UPDATE link SET priority = priority + 1 WHERE link.priority >= NEW.priority AND NOT link.priority >= OLD.priority; END CASE; RETURN NEW; END;