diff options
author | Michael Paquier <michael@paquier.xyz> | 2020-12-08 12:13:19 +0900 |
---|---|---|
committer | Michael Paquier <michael@paquier.xyz> | 2020-12-08 12:13:19 +0900 |
commit | 947789f1f5fb61daf663f26325cbe7cad8197d58 (patch) | |
tree | 6310d17a0d8c63a0b3b50cd81ccf9b720389159e /src/backend/access/heap/heapam.c | |
parent | 0a665bbc43c5a678331fb1b1f44274500eba6563 (diff) | |
download | postgresql-947789f1f5fb61daf663f26325cbe7cad8197d58.tar.gz postgresql-947789f1f5fb61daf663f26325cbe7cad8197d58.zip |
Avoid using tuple from syscache for update of pg_database.datfrozenxid
pg_database.datfrozenxid gets updated using an in-place update at the
end of vacuum or autovacuum. Since 96cdeae, as pg_database has a toast
relation, it is possible for a pg_database tuple to have toast values
if there is a large set of ACLs in place. In such a case, the in-place
update would fail because of the flattening of the toast values done for
the catcache entry fetched. Instead of using a copy from the catcache,
this changes the logic to fetch the copy of the tuple by directly
scanning pg_database.
Per the lack of complaints on the matter, no backpatch is done. Note
that before 96cdeae, attempting to insert such a tuple to pg_database
would cause a "row is too big" error, so the end-of-vacuum problem was
not reachable.
Author: Ashwin Agrawal, Junfeng Yang
Discussion: https://postgr.es/m/DM5PR0501MB38800D9E4605BCA72DD35557CCE10@DM5PR0501MB3880.namprd05.prod.outlook.com
Diffstat (limited to 'src/backend/access/heap/heapam.c')
-rw-r--r-- | src/backend/access/heap/heapam.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/backend/access/heap/heapam.c b/src/backend/access/heap/heapam.c index 1b2f70499e5..a9583f31036 100644 --- a/src/backend/access/heap/heapam.c +++ b/src/backend/access/heap/heapam.c @@ -5710,6 +5710,10 @@ heap_abort_speculative(Relation relation, ItemPointer tid) * * tuple is an in-memory tuple structure containing the data to be written * over the target tuple. Also, tuple->t_self identifies the target tuple. + * + * Note that the tuple updated here had better not come directly from the + * syscache if the relation has a toast relation as this tuple could + * include toast values that have been expanded, causing a failure here. */ void heap_inplace_update(Relation relation, HeapTuple tuple) |