pgsql: Fix heap_getattr() handling of fast defaults.

Поиск
Список
Период
Сортировка
От Andres Freund
Тема pgsql: Fix heap_getattr() handling of fast defaults.
Дата
Msg-id E1grJKJ-0002pK-JT@gemulon.postgresql.org
обсуждение исходный текст
Список pgsql-committers
Fix heap_getattr() handling of fast defaults.

Previously heap_getattr() returned NULL for attributes with a fast
default value (c.f. 16828d5c0273), as it had no handling whatsoever
for that case.

A previous fix, 7636e5c60f, attempted to fix issues caused by this
oversight, but just expanding OLD tuples for triggers doesn't actually
solve the underlying issue.

One known consequence of this bug is that the check for HOT updates
can return the wrong result, when a previously fast-default'ed column
is set to NULL. Which in turn means that an index over a column with
fast default'ed columns might be corrupt if the underlying column(s)
allow NULLs.

Fix by handling fast default columns in heap_getattr(), remove now
superfluous expansion in GetTupleForTrigger().

Author: Andres Freund
Discussion: https://postgr.es/m/20190201162404.onngi77f26baem4g@alap3.anarazel.de
Backpatch: 11, where fast defaults were introduced

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/171e0418b03dc103d5d9bdc0bfaadbb193dd7fd6

Modified Files
--------------
src/backend/access/common/heaptuple.c      |  4 +---
src/backend/commands/trigger.c             |  5 +----
src/include/access/htup_details.h          |  7 +++----
src/test/regress/expected/fast_default.out | 27 +++++++++++++++++++++++++++
src/test/regress/sql/fast_default.sql      | 20 ++++++++++++++++++++
5 files changed, 52 insertions(+), 11 deletions(-)


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

Предыдущее
От: Michael Paquier
Дата:
Сообщение: pgsql: Tighten some regexes with proper character escaping in pg_dumpT
Следующее
От: Andres Freund
Дата:
Сообщение: pgsql: Fix heap_getattr() handling of fast defaults.