gzh <gzhcoder@xxxxxxx> writes: > I upgraded the version of PostgreSQL from 12.13 to 12.16. > If multiple subqueries or a large number of UNION ALL were used, > the previously unseen error message "ERROR: stack depth limit exceeded" will appear after upgrading the version. Please provide a self-contained example. The people who might be able to fix this are too busy to guess about what you are seeing. regards, tom lane