diff options
author | Bruce Momjian <bruce@momjian.us> | 2023-10-31 09:10:35 -0400 |
---|---|---|
committer | Bruce Momjian <bruce@momjian.us> | 2023-10-31 09:10:35 -0400 |
commit | 989adace3f19010f21009477afb5b50e1a4dd3c6 (patch) | |
tree | 6bfca03fb95d3eef310c3608c8c035dcf4df1ae8 /src/backend/access/common/heaptuple.c | |
parent | 75e700db45141d073e671f7c7b4aacee1ebc629a (diff) |
doc: 1-byte varlena headers can be used for user PLAIN storage
This also updates some C comments.
Reported-by: suchithjn22@gmail.com
Discussion: https://postgr.es/m/167336599095.2667301.15497893107226841625@wrigleys.postgresql.org
Author: Laurenz Albe (doc patch)
Backpatch-through: 11
Diffstat (limited to 'src/backend/access/common/heaptuple.c')
-rw-r--r-- | src/backend/access/common/heaptuple.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/backend/access/common/heaptuple.c b/src/backend/access/common/heaptuple.c index d6a4ddfd51f..c52d40dce0f 100644 --- a/src/backend/access/common/heaptuple.c +++ b/src/backend/access/common/heaptuple.c @@ -68,7 +68,16 @@ #include "utils/memutils.h" -/* Does att's datatype allow packing into the 1-byte-header varlena format? */ +/* + * Does att's datatype allow packing into the 1-byte-header varlena format? + * While functions that use TupleDescAttr() and assign attstorage = + * TYPSTORAGE_PLAIN cannot use packed varlena headers, functions that call + * TupleDescInitEntry() use typeForm->typstorage (TYPSTORAGE_EXTENDED) and + * can use packed varlena headers, e.g.: + * CREATE TABLE test(a VARCHAR(10000) STORAGE PLAIN); + * INSERT INTO test VALUES (repeat('A',10)); + * This can be verified with pageinspect. + */ #define ATT_IS_PACKABLE(att) \ ((att)->attlen == -1 && (att)->attstorage != TYPSTORAGE_PLAIN) /* Use this if it's already known varlena */ |