mirror of
				https://github.com/postgres/postgres.git
				synced 2025-11-03 09:13:20 +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:
		@@ -452,9 +452,7 @@ for storing <acronym>TOAST</acronym>-able columns on disk:
 | 
				
			|||||||
    <listitem>
 | 
					    <listitem>
 | 
				
			||||||
     <para>
 | 
					     <para>
 | 
				
			||||||
      <literal>PLAIN</literal> prevents either compression or
 | 
					      <literal>PLAIN</literal> prevents either compression or
 | 
				
			||||||
      out-of-line storage; furthermore it disables use of single-byte headers
 | 
					      out-of-line storage.  This is the only possible strategy for
 | 
				
			||||||
      for varlena types.
 | 
					 | 
				
			||||||
      This is the only possible strategy for
 | 
					 | 
				
			||||||
      columns of non-<acronym>TOAST</acronym>-able data types.
 | 
					      columns of non-<acronym>TOAST</acronym>-able data types.
 | 
				
			||||||
     </para>
 | 
					     </para>
 | 
				
			||||||
    </listitem>
 | 
					    </listitem>
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -68,7 +68,16 @@
 | 
				
			|||||||
#include "utils/memutils.h"
 | 
					#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) \
 | 
					#define ATT_IS_PACKABLE(att) \
 | 
				
			||||||
	((att)->attlen == -1 && (att)->attstorage != 'p')
 | 
						((att)->attlen == -1 && (att)->attstorage != 'p')
 | 
				
			||||||
/* Use this if it's already known varlena */
 | 
					/* Use this if it's already known varlena */
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -2384,7 +2384,8 @@ range_contains_elem_internal(TypeCacheEntry *typcache, RangeType *r, Datum val)
 | 
				
			|||||||
 * values into a range object.  They are modeled after heaptuple.c's
 | 
					 * values into a range object.  They are modeled after heaptuple.c's
 | 
				
			||||||
 * heap_compute_data_size() and heap_fill_tuple(), but we need not handle
 | 
					 * heap_compute_data_size() and heap_fill_tuple(), but we need not handle
 | 
				
			||||||
 * null values here.  TYPE_IS_PACKABLE must test the same conditions as
 | 
					 * null values here.  TYPE_IS_PACKABLE must test the same conditions as
 | 
				
			||||||
 * heaptuple.c's ATT_IS_PACKABLE macro.
 | 
					 * heaptuple.c's ATT_IS_PACKABLE macro.  See the comments thare for more
 | 
				
			||||||
 | 
					 * details.
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* Does datatype allow packing into the 1-byte-header varlena format? */
 | 
					/* Does datatype allow packing into the 1-byte-header varlena format? */
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user