Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitfbaee69

Browse files
committed
doc: 1-byte varlena headers can be used for user PLAIN storage
This also updates some C comments.Reported-by: suchithjn22@gmail.comDiscussion:https://postgr.es/m/167336599095.2667301.15497893107226841625@wrigleys.postgresql.orgAuthor: Laurenz Albe (doc patch)Backpatch-through: 11
1 parentb3c8d1d commitfbaee69

File tree

3 files changed

+13
-5
lines changed

3 files changed

+13
-5
lines changed

‎doc/src/sgml/storage.sgml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -452,9 +452,7 @@ for storing <acronym>TOAST</acronym>-able columns on disk:
452452
<listitem>
453453
<para>
454454
<literal>PLAIN</literal> prevents either compression or
455-
out-of-line storage; furthermore it disables use of single-byte headers
456-
for varlena types.
457-
This is the only possible strategy for
455+
out-of-line storage. This is the only possible strategy for
458456
columns of non-<acronym>TOAST</acronym>-able data types.
459457
</para>
460458
</listitem>

‎src/backend/access/common/heaptuple.c

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,16 @@
6868
#include"utils/memutils.h"
6969

7070

71-
/* Does att's datatype allow packing into the 1-byte-header varlena format? */
71+
/*
72+
* Does att's datatype allow packing into the 1-byte-header varlena format?
73+
* While functions that use TupleDescAttr() and assign attstorage =
74+
* TYPSTORAGE_PLAIN cannot use packed varlena headers, functions that call
75+
* TupleDescInitEntry() use typeForm->typstorage (TYPSTORAGE_EXTENDED) and
76+
* can use packed varlena headers, e.g.:
77+
* CREATE TABLE test(a VARCHAR(10000) STORAGE PLAIN);
78+
* INSERT INTO test VALUES (repeat('A',10));
79+
* This can be verified with pageinspect.
80+
*/
7281
#defineATT_IS_PACKABLE(att) \
7382
((att)->attlen == -1 && (att)->attstorage != TYPSTORAGE_PLAIN)
7483
/* Use this if it's already known varlena */

‎src/backend/utils/adt/rangetypes.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2384,7 +2384,8 @@ range_contains_elem_internal(TypeCacheEntry *typcache, const RangeType *r, Datum
23842384
* values into a range object. They are modeled after heaptuple.c's
23852385
* heap_compute_data_size() and heap_fill_tuple(), but we need not handle
23862386
* null values here. TYPE_IS_PACKABLE must test the same conditions as
2387-
* heaptuple.c's ATT_IS_PACKABLE macro.
2387+
* heaptuple.c's ATT_IS_PACKABLE macro. See the comments thare for more
2388+
* details.
23882389
*/
23892390

23902391
/* Does datatype allow packing into the 1-byte-header varlena format? */

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp