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

Commit55ce8fc

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 parentbae063d commit55ce8fc

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
@@ -444,9 +444,7 @@ for storing <acronym>TOAST</acronym>-able columns on disk:
444444
<listitem>
445445
<para>
446446
<literal>PLAIN</literal> prevents either compression or
447-
out-of-line storage; furthermore it disables use of single-byte headers
448-
for varlena types.
449-
This is the only possible strategy for
447+
out-of-line storage. This is the only possible strategy for
450448
columns of non-<acronym>TOAST</acronym>-able data types.
451449
</para>
452450
</listitem>

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

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

7171

72-
/* Does att's datatype allow packing into the 1-byte-header varlena format? */
72+
/*
73+
* Does att's datatype allow packing into the 1-byte-header varlena format?
74+
* While functions that use TupleDescAttr() and assign attstorage =
75+
* TYPSTORAGE_PLAIN cannot use packed varlena headers, functions that call
76+
* TupleDescInitEntry() use typeForm->typstorage (TYPSTORAGE_EXTENDED) and
77+
* can use packed varlena headers, e.g.:
78+
* CREATE TABLE test(a VARCHAR(10000) STORAGE PLAIN);
79+
* INSERT INTO test VALUES (repeat('A',10));
80+
* This can be verified with pageinspect.
81+
*/
7382
#defineATT_IS_PACKABLE(att) \
7483
((att)->attlen == -1 && (att)->attstorage != 'p')
7584
/* 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
@@ -2383,7 +2383,8 @@ range_contains_elem_internal(TypeCacheEntry *typcache, RangeType *r, Datum val)
23832383
* values into a range object. They are modeled after heaptuple.c's
23842384
* heap_compute_data_size() and heap_fill_tuple(), but we need not handle
23852385
* null values here. TYPE_IS_PACKABLE must test the same conditions as
2386-
* heaptuple.c's ATT_IS_PACKABLE macro.
2386+
* heaptuple.c's ATT_IS_PACKABLE macro. See the comments thare for more
2387+
* details.
23872388
*/
23882389

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

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp