1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-11 10:01:57 +03:00

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
This commit is contained in:
Bruce Momjian
2023-10-31 09:10:35 -04:00
parent 75e700db45
commit 989adace3f
3 changed files with 13 additions and 5 deletions

View File

@ -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 */