pgsql: In transformRowExpr(), check for too many columns in the row.

Поиск
Список
Период
Сортировка
От Tom Lane
Тема pgsql: In transformRowExpr(), check for too many columns in the row.
Дата
Msg-id E1oHTpi-001oL6-KR@gemulon.postgresql.org
обсуждение исходный текст
Список pgsql-committers
In transformRowExpr(), check for too many columns in the row.

A RowExpr with more than MaxTupleAttributeNumber columns would fail at
execution anyway, since we cannot form a tuple datum with more than that
many columns.  While heap_form_tuple() has a check for too many columns,
it emerges that there are some intermediate bits of code that don't
check and can be driven to failure with sufficiently many columns.
Checking this at parse time seems like the most appropriate place to
install a defense, since we already check SELECT list length there.

While at it, make the SELECT-list-length error use the same errcode
(TOO_MANY_COLUMNS) as heap_form_tuple does, rather than the generic
PROGRAM_LIMIT_EXCEEDED.

Per bug #17561 from Egor Chindyaskin.  The given test case crashes
in all supported branches (and probably a lot further back),
so patch all.

Discussion: https://postgr.es/m/17561-80350151b9ad2ad4@postgresql.org

Branch
------
REL_11_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/8dea18372f555d636503b84aff436d8d8120e236

Modified Files
--------------
src/backend/parser/parse_expr.c | 9 +++++++++
src/backend/parser/parse_node.c | 2 +-
2 files changed, 10 insertions(+), 1 deletion(-)


В списке pgsql-committers по дате отправления:

Предыдущее
От: Robert Haas
Дата:
Сообщение: pgsql: Fix mistake in bbe08b8869bd29d587f24ef18eb45c7d4d14afca.
Следующее
От: Tom Lane
Дата:
Сообщение: pgsql: Support pg_read_[binary_]file (filename, missing_ok).