pgsql: Avoid recursion while processing ELSIF lists in plpgsql.
От | Tom Lane |
---|---|
Тема | pgsql: Avoid recursion while processing ELSIF lists in plpgsql. |
Дата | |
Msg-id | E1RJVWf-00062T-PD@gemulon.postgresql.org обсуждение исходный текст |
Список | pgsql-committers |
Avoid recursion while processing ELSIF lists in plpgsql. The original implementation of ELSIF in plpgsql converted the construct into nested simple IF statements. This was prone to stack overflow with long ELSIF lists, in two different ways. First, it's difficult to generate the parsetree without using right-recursion in the bison grammar, and that's prone to parser stack overflow since nothing can be reduced until the whole list has been read. Second, we'd recurse during execution, thus creating an unnecessary risk of execution-time stack overflow. Rewrite so that the ELSIF list is represented as a flat list, scanned via iteration not recursion, and generated through left-recursion in the grammar. Per a gripe from Håvard Kongsgård. Branch ------ master Details ------- http://git.postgresql.org/pg/commitdiff/051d1ba7a02d0e8930adf228d60e8a044b9fcadb Modified Files -------------- src/pl/plpgsql/src/gram.y | 52 +++++++++++++++------------------------- src/pl/plpgsql/src/pl_exec.c | 20 ++++++++------- src/pl/plpgsql/src/pl_funcs.c | 32 +++++++++++++++++++----- src/pl/plpgsql/src/plpgsql.h | 14 ++++++++-- 4 files changed, 67 insertions(+), 51 deletions(-)
В списке pgsql-committers по дате отправления: