Postgres Trigger Max Stack Problem Leetcode Python