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

Commit989adac

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 parent75e700d commit989adac

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
@@ -456,9 +456,7 @@ for storing <acronym>TOAST</acronym>-able columns on disk:
456456
<listitem>
457457
<para>
458458
<literal>PLAIN</literal> prevents either compression or
459-
out-of-line storage; furthermore it disables use of single-byte headers
460-
for varlena types.
461-
This is the only possible strategy for
459+
out-of-line storage. This is the only possible strategy for
462460
columns of non-<acronym>TOAST</acronym>-able data types.
463461
</para>
464462
</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
@@ -2608,7 +2608,8 @@ range_contains_elem_internal(TypeCacheEntry *typcache, const RangeType *r, Datum
26082608
* values into a range object. They are modeled after heaptuple.c's
26092609
* heap_compute_data_size() and heap_fill_tuple(), but we need not handle
26102610
* null values here. TYPE_IS_PACKABLE must test the same conditions as
2611-
* heaptuple.c's ATT_IS_PACKABLE macro.
2611+
* heaptuple.c's ATT_IS_PACKABLE macro. See the comments thare for more
2612+
* details.
26122613
*/
26132614

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

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp