PostgreSQL Source Code  git master
detoast.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define VARATT_EXTERNAL_IS_COMPRESSED(toast_pointer)   ((toast_pointer).va_extsize < (toast_pointer).va_rawsize - VARHDRSZ)
 
#define VARATT_EXTERNAL_GET_POINTER(toast_pointer, attr)
 
#define TOAST_POINTER_SIZE   (VARHDRSZ_EXTERNAL + sizeof(varatt_external))
 
#define INDIRECT_POINTER_SIZE   (VARHDRSZ_EXTERNAL + sizeof(varatt_indirect))
 

Functions

struct varlenadetoast_external_attr (struct varlena *attr)
 
struct varlenadetoast_attr (struct varlena *attr)
 
struct varlenadetoast_attr_slice (struct varlena *attr, int32 sliceoffset, int32 slicelength)
 
Size toast_raw_datum_size (Datum value)
 
Size toast_datum_size (Datum value)
 

Macro Definition Documentation

◆ INDIRECT_POINTER_SIZE

#define INDIRECT_POINTER_SIZE   (VARHDRSZ_EXTERNAL + sizeof(varatt_indirect))

Definition at line 44 of file detoast.h.

Referenced by make_tuple_indirect(), and ReorderBufferToastReplace().

◆ TOAST_POINTER_SIZE

#define TOAST_POINTER_SIZE   (VARHDRSZ_EXTERNAL + sizeof(varatt_external))

Definition at line 41 of file detoast.h.

Referenced by toast_save_datum(), and toast_tuple_find_biggest_attribute().

◆ VARATT_EXTERNAL_GET_POINTER

#define VARATT_EXTERNAL_GET_POINTER (   toast_pointer,
  attr 
)
Value:
do { \
varattrib_1b_e *attre = (varattrib_1b_e *) (attr); \
Assert(VARATT_IS_EXTERNAL(attre)); \
Assert(VARSIZE_EXTERNAL(attre) == sizeof(toast_pointer) + VARHDRSZ_EXTERNAL); \
memcpy(&(toast_pointer), VARDATA_EXTERNAL(attre), sizeof(toast_pointer)); \
} while (0)
#define VARHDRSZ_EXTERNAL
Definition: postgres.h:276
#define VARDATA_EXTERNAL(PTR)
Definition: postgres.h:310
#define VARATT_IS_EXTERNAL(PTR)
Definition: postgres.h:313
#define VARSIZE_EXTERNAL(PTR)
Definition: postgres.h:309

Definition at line 32 of file detoast.h.

Referenced by detoast_attr(), detoast_attr_slice(), detoast_external_attr(), ReorderBufferToastReplace(), toast_datum_size(), toast_delete_datum(), toast_fetch_datum(), toast_fetch_datum_slice(), toast_raw_datum_size(), and toast_save_datum().

◆ VARATT_EXTERNAL_IS_COMPRESSED

#define VARATT_EXTERNAL_IS_COMPRESSED (   toast_pointer)    ((toast_pointer).va_extsize < (toast_pointer).va_rawsize - VARHDRSZ)

Function Documentation

◆ detoast_attr()

struct varlena* detoast_attr ( struct varlena attr)

Definition at line 116 of file detoast.c.

References Assert, detoast_attr(), detoast_external_attr(), palloc(), pfree(), varatt_indirect::pointer, SET_VARSIZE, toast_decompress_datum(), toast_fetch_datum(), VARATT_EXTERNAL_GET_POINTER, VARATT_IS_COMPRESSED, VARATT_IS_EXTENDED, VARATT_IS_EXTERNAL_EXPANDED, VARATT_IS_EXTERNAL_INDIRECT, VARATT_IS_EXTERNAL_ONDISK, VARATT_IS_SHORT, VARDATA, VARDATA_SHORT, VARHDRSZ, VARHDRSZ_SHORT, VARSIZE_ANY, and VARSIZE_SHORT.

Referenced by detoast_attr(), getdatafield(), pg_detoast_datum(), pg_detoast_datum_copy(), pg_detoast_datum_packed(), toast_flatten_tuple_to_datum(), and toast_tuple_init().

117 {
118  if (VARATT_IS_EXTERNAL_ONDISK(attr))
119  {
120  /*
121  * This is an externally stored datum --- fetch it back from there
122  */
123  attr = toast_fetch_datum(attr);
124  /* If it's compressed, decompress it */
125  if (VARATT_IS_COMPRESSED(attr))
126  {
127  struct varlena *tmp = attr;
128 
129  attr = toast_decompress_datum(tmp);
130  pfree(tmp);
131  }
132  }
133  else if (VARATT_IS_EXTERNAL_INDIRECT(attr))
134  {
135  /*
136  * This is an indirect pointer --- dereference it
137  */
138  struct varatt_indirect redirect;
139 
140  VARATT_EXTERNAL_GET_POINTER(redirect, attr);
141  attr = (struct varlena *) redirect.pointer;
142 
143  /* nested indirect Datums aren't allowed */
145 
146  /* recurse in case value is still extended in some other way */
147  attr = detoast_attr(attr);
148 
149  /* if it isn't, we'd better copy it */
150  if (attr == (struct varlena *) redirect.pointer)
151  {
152  struct varlena *result;
153 
154  result = (struct varlena *) palloc(VARSIZE_ANY(attr));
155  memcpy(result, attr, VARSIZE_ANY(attr));
156  attr = result;
157  }
158  }
159  else if (VARATT_IS_EXTERNAL_EXPANDED(attr))
160  {
161  /*
162  * This is an expanded-object pointer --- get flat format
163  */
164  attr = detoast_external_attr(attr);
165  /* flatteners are not allowed to produce compressed/short output */
166  Assert(!VARATT_IS_EXTENDED(attr));
167  }
168  else if (VARATT_IS_COMPRESSED(attr))
169  {
170  /*
171  * This is a compressed value inside of the main tuple
172  */
173  attr = toast_decompress_datum(attr);
174  }
175  else if (VARATT_IS_SHORT(attr))
176  {
177  /*
178  * This is a short-header varlena --- convert to 4-byte header format
179  */
180  Size data_size = VARSIZE_SHORT(attr) - VARHDRSZ_SHORT;
181  Size new_size = data_size + VARHDRSZ;
182  struct varlena *new_attr;
183 
184  new_attr = (struct varlena *) palloc(new_size);
185  SET_VARSIZE(new_attr, new_size);
186  memcpy(VARDATA(new_attr), VARDATA_SHORT(attr), data_size);
187  attr = new_attr;
188  }
189 
190  return attr;
191 }
#define VARATT_IS_EXTERNAL_ONDISK(PTR)
Definition: postgres.h:314
#define VARATT_IS_COMPRESSED(PTR)
Definition: postgres.h:312
#define VARDATA(PTR)
Definition: postgres.h:302
#define VARATT_IS_EXTERNAL_EXPANDED(PTR)
Definition: postgres.h:322
#define VARHDRSZ_SHORT
Definition: postgres.h:268
#define VARATT_EXTERNAL_GET_POINTER(toast_pointer, attr)
Definition: detoast.h:32
#define VARHDRSZ
Definition: c.h:555
struct varlena * detoast_external_attr(struct varlena *attr)
Definition: detoast.c:45
struct varlena * detoast_attr(struct varlena *attr)
Definition: detoast.c:116
void pfree(void *pointer)
Definition: mcxt.c:1056
#define VARATT_IS_EXTERNAL_INDIRECT(PTR)
Definition: postgres.h:316
#define VARATT_IS_SHORT(PTR)
Definition: postgres.h:326
#define VARSIZE_SHORT(PTR)
Definition: postgres.h:305
#define VARSIZE_ANY(PTR)
Definition: postgres.h:335
static struct varlena * toast_fetch_datum(struct varlena *attr)
Definition: detoast.c:324
#define Assert(condition)
Definition: c.h:732
size_t Size
Definition: c.h:466
#define VARATT_IS_EXTENDED(PTR)
Definition: postgres.h:327
#define VARDATA_SHORT(PTR)
Definition: postgres.h:306
void * palloc(Size size)
Definition: mcxt.c:949
Definition: c.h:549
#define SET_VARSIZE(PTR, len)
Definition: postgres.h:329
static struct varlena * toast_decompress_datum(struct varlena *attr)
Definition: detoast.c:750

◆ detoast_attr_slice()

struct varlena* detoast_attr_slice ( struct varlena attr,
int32  sliceoffset,
int32  slicelength 
)

Definition at line 204 of file detoast.c.

References Assert, detoast_attr_slice(), detoast_external_attr(), palloc(), pfree(), pglz_maximum_compressed_size(), varatt_indirect::pointer, SET_VARSIZE, TOAST_COMPRESS_SIZE, toast_decompress_datum(), toast_decompress_datum_slice(), toast_fetch_datum(), toast_fetch_datum_slice(), VARATT_EXTERNAL_GET_POINTER, VARATT_EXTERNAL_IS_COMPRESSED, VARATT_IS_COMPRESSED, VARATT_IS_EXTERNAL, VARATT_IS_EXTERNAL_EXPANDED, VARATT_IS_EXTERNAL_INDIRECT, VARATT_IS_EXTERNAL_ONDISK, VARATT_IS_SHORT, VARDATA, VARDATA_SHORT, VARHDRSZ, VARHDRSZ_SHORT, VARSIZE, and VARSIZE_SHORT.

Referenced by detoast_attr_slice(), and pg_detoast_datum_slice().

206 {
207  struct varlena *preslice;
208  struct varlena *result;
209  char *attrdata;
210  int32 attrsize;
211 
212  if (VARATT_IS_EXTERNAL_ONDISK(attr))
213  {
214  struct varatt_external toast_pointer;
215 
216  VARATT_EXTERNAL_GET_POINTER(toast_pointer, attr);
217 
218  /* fast path for non-compressed external datums */
219  if (!VARATT_EXTERNAL_IS_COMPRESSED(toast_pointer))
220  return toast_fetch_datum_slice(attr, sliceoffset, slicelength);
221 
222  /*
223  * For compressed values, we need to fetch enough slices to decompress
224  * at least the requested part (when a prefix is requested). Otherwise,
225  * just fetch all slices.
226  */
227  if (slicelength > 0 && sliceoffset >= 0)
228  {
229  int32 max_size;
230 
231  /*
232  * Determine maximum amount of compressed data needed for a prefix
233  * of a given length (after decompression).
234  */
235  max_size = pglz_maximum_compressed_size(sliceoffset + slicelength,
236  TOAST_COMPRESS_SIZE(attr));
237 
238  /*
239  * Fetch enough compressed slices (compressed marker will get set
240  * automatically).
241  */
242  preslice = toast_fetch_datum_slice(attr, 0, max_size);
243  }
244  else
245  preslice = toast_fetch_datum(attr);
246  }
247  else if (VARATT_IS_EXTERNAL_INDIRECT(attr))
248  {
249  struct varatt_indirect redirect;
250 
251  VARATT_EXTERNAL_GET_POINTER(redirect, attr);
252 
253  /* nested indirect Datums aren't allowed */
254  Assert(!VARATT_IS_EXTERNAL_INDIRECT(redirect.pointer));
255 
256  return detoast_attr_slice(redirect.pointer,
257  sliceoffset, slicelength);
258  }
259  else if (VARATT_IS_EXTERNAL_EXPANDED(attr))
260  {
261  /* pass it off to detoast_external_attr to flatten */
262  preslice = detoast_external_attr(attr);
263  }
264  else
265  preslice = attr;
266 
267  Assert(!VARATT_IS_EXTERNAL(preslice));
268 
269  if (VARATT_IS_COMPRESSED(preslice))
270  {
271  struct varlena *tmp = preslice;
272 
273  /* Decompress enough to encompass the slice and the offset */
274  if (slicelength > 0 && sliceoffset >= 0)
275  preslice = toast_decompress_datum_slice(tmp, slicelength + sliceoffset);
276  else
277  preslice = toast_decompress_datum(tmp);
278 
279  if (tmp != attr)
280  pfree(tmp);
281  }
282 
283  if (VARATT_IS_SHORT(preslice))
284  {
285  attrdata = VARDATA_SHORT(preslice);
286  attrsize = VARSIZE_SHORT(preslice) - VARHDRSZ_SHORT;
287  }
288  else
289  {
290  attrdata = VARDATA(preslice);
291  attrsize = VARSIZE(preslice) - VARHDRSZ;
292  }
293 
294  /* slicing of datum for compressed cases and plain value */
295 
296  if (sliceoffset >= attrsize)
297  {
298  sliceoffset = 0;
299  slicelength = 0;
300  }
301 
302  if (((sliceoffset + slicelength) > attrsize) || slicelength < 0)
303  slicelength = attrsize - sliceoffset;
304 
305  result = (struct varlena *) palloc(slicelength + VARHDRSZ);
306  SET_VARSIZE(result, slicelength + VARHDRSZ);
307 
308  memcpy(VARDATA(result), attrdata + sliceoffset, slicelength);
309 
310  if (preslice != attr)
311  pfree(preslice);
312 
313  return result;
314 }
#define VARATT_IS_EXTERNAL_ONDISK(PTR)
Definition: postgres.h:314
#define VARATT_IS_COMPRESSED(PTR)
Definition: postgres.h:312
int32 pglz_maximum_compressed_size(int32 rawsize, int32 total_compressed_size)
#define VARDATA(PTR)
Definition: postgres.h:302
#define VARATT_IS_EXTERNAL_EXPANDED(PTR)
Definition: postgres.h:322
static struct varlena * toast_fetch_datum_slice(struct varlena *attr, int32 sliceoffset, int32 length)
Definition: detoast.c:509
#define VARHDRSZ_SHORT
Definition: postgres.h:268
#define VARSIZE(PTR)
Definition: postgres.h:303
#define VARATT_EXTERNAL_GET_POINTER(toast_pointer, attr)
Definition: detoast.h:32
#define VARHDRSZ
Definition: c.h:555
struct varlena * detoast_external_attr(struct varlena *attr)
Definition: detoast.c:45
struct varlena * detoast_attr_slice(struct varlena *attr, int32 sliceoffset, int32 slicelength)
Definition: detoast.c:204
signed int int32
Definition: c.h:346
#define VARATT_IS_EXTERNAL(PTR)
Definition: postgres.h:313
void pfree(void *pointer)
Definition: mcxt.c:1056
#define VARATT_IS_EXTERNAL_INDIRECT(PTR)
Definition: postgres.h:316
#define VARATT_IS_SHORT(PTR)
Definition: postgres.h:326
#define VARSIZE_SHORT(PTR)
Definition: postgres.h:305
#define TOAST_COMPRESS_SIZE(ptr)
static struct varlena * toast_fetch_datum(struct varlena *attr)
Definition: detoast.c:324
#define Assert(condition)
Definition: c.h:732
#define VARDATA_SHORT(PTR)
Definition: postgres.h:306
void * palloc(Size size)
Definition: mcxt.c:949
#define VARATT_EXTERNAL_IS_COMPRESSED(toast_pointer)
Definition: detoast.h:22
Definition: c.h:549
#define SET_VARSIZE(PTR, len)
Definition: postgres.h:329
static struct varlena * toast_decompress_datum(struct varlena *attr)
Definition: detoast.c:750
static struct varlena * toast_decompress_datum_slice(struct varlena *attr, int32 slicelength)
Definition: detoast.c:778

◆ detoast_external_attr()

struct varlena* detoast_external_attr ( struct varlena attr)

Definition at line 45 of file detoast.c.

References Assert, DatumGetEOHP(), detoast_external_attr(), EOH_flatten_into(), EOH_get_flat_size(), palloc(), varatt_indirect::pointer, PointerGetDatum, toast_fetch_datum(), VARATT_EXTERNAL_GET_POINTER, VARATT_IS_EXTERNAL, VARATT_IS_EXTERNAL_EXPANDED, VARATT_IS_EXTERNAL_INDIRECT, VARATT_IS_EXTERNAL_ONDISK, and VARSIZE_ANY.

Referenced by assign_simple_var(), detoast_attr(), detoast_attr_slice(), detoast_external_attr(), expanded_record_set_field_internal(), expanded_record_set_fields(), index_form_tuple(), make_tuple_indirect(), toast_build_flattened_tuple(), toast_flatten_tuple(), toast_tuple_init(), and tstoreReceiveSlot_detoast().

46 {
47  struct varlena *result;
48 
49  if (VARATT_IS_EXTERNAL_ONDISK(attr))
50  {
51  /*
52  * This is an external stored plain value
53  */
54  result = toast_fetch_datum(attr);
55  }
56  else if (VARATT_IS_EXTERNAL_INDIRECT(attr))
57  {
58  /*
59  * This is an indirect pointer --- dereference it
60  */
61  struct varatt_indirect redirect;
62 
63  VARATT_EXTERNAL_GET_POINTER(redirect, attr);
64  attr = (struct varlena *) redirect.pointer;
65 
66  /* nested indirect Datums aren't allowed */
68 
69  /* recurse if value is still external in some other way */
70  if (VARATT_IS_EXTERNAL(attr))
71  return detoast_external_attr(attr);
72 
73  /*
74  * Copy into the caller's memory context, in case caller tries to
75  * pfree the result.
76  */
77  result = (struct varlena *) palloc(VARSIZE_ANY(attr));
78  memcpy(result, attr, VARSIZE_ANY(attr));
79  }
80  else if (VARATT_IS_EXTERNAL_EXPANDED(attr))
81  {
82  /*
83  * This is an expanded-object pointer --- get flat format
84  */
86  Size resultsize;
87 
88  eoh = DatumGetEOHP(PointerGetDatum(attr));
89  resultsize = EOH_get_flat_size(eoh);
90  result = (struct varlena *) palloc(resultsize);
91  EOH_flatten_into(eoh, (void *) result, resultsize);
92  }
93  else
94  {
95  /*
96  * This is a plain value inside of the main tuple - why am I called?
97  */
98  result = attr;
99  }
100 
101  return result;
102 }
#define VARATT_IS_EXTERNAL_ONDISK(PTR)
Definition: postgres.h:314
#define VARATT_IS_EXTERNAL_EXPANDED(PTR)
Definition: postgres.h:322
#define VARATT_EXTERNAL_GET_POINTER(toast_pointer, attr)
Definition: detoast.h:32
#define PointerGetDatum(X)
Definition: postgres.h:556
struct varlena * detoast_external_attr(struct varlena *attr)
Definition: detoast.c:45
#define VARATT_IS_EXTERNAL(PTR)
Definition: postgres.h:313
#define VARATT_IS_EXTERNAL_INDIRECT(PTR)
Definition: postgres.h:316
Size EOH_get_flat_size(ExpandedObjectHeader *eohptr)
Definition: expandeddatum.c:75
ExpandedObjectHeader * DatumGetEOHP(Datum d)
Definition: expandeddatum.c:29
void EOH_flatten_into(ExpandedObjectHeader *eohptr, void *result, Size allocated_size)
Definition: expandeddatum.c:81
#define VARSIZE_ANY(PTR)
Definition: postgres.h:335
static struct varlena * toast_fetch_datum(struct varlena *attr)
Definition: detoast.c:324
#define Assert(condition)
Definition: c.h:732
size_t Size
Definition: c.h:466
void * palloc(Size size)
Definition: mcxt.c:949
Definition: c.h:549

◆ toast_datum_size()

Size toast_datum_size ( Datum  value)

Definition at line 862 of file detoast.c.

References Assert, DatumGetEOHP(), DatumGetPointer, EOH_get_flat_size(), varatt_indirect::pointer, PointerGetDatum, toast_datum_size(), varatt_external::va_extsize, VARATT_EXTERNAL_GET_POINTER, VARATT_IS_EXTERNAL_EXPANDED, VARATT_IS_EXTERNAL_INDIRECT, VARATT_IS_EXTERNAL_ONDISK, VARATT_IS_SHORT, VARSIZE, and VARSIZE_SHORT.

Referenced by pg_column_size(), and toast_datum_size().

863 {
864  struct varlena *attr = (struct varlena *) DatumGetPointer(value);
865  Size result;
866 
867  if (VARATT_IS_EXTERNAL_ONDISK(attr))
868  {
869  /*
870  * Attribute is stored externally - return the extsize whether
871  * compressed or not. We do not count the size of the toast pointer
872  * ... should we?
873  */
874  struct varatt_external toast_pointer;
875 
876  VARATT_EXTERNAL_GET_POINTER(toast_pointer, attr);
877  result = toast_pointer.va_extsize;
878  }
879  else if (VARATT_IS_EXTERNAL_INDIRECT(attr))
880  {
881  struct varatt_indirect toast_pointer;
882 
883  VARATT_EXTERNAL_GET_POINTER(toast_pointer, attr);
884 
885  /* nested indirect Datums aren't allowed */
887 
888  return toast_datum_size(PointerGetDatum(toast_pointer.pointer));
889  }
890  else if (VARATT_IS_EXTERNAL_EXPANDED(attr))
891  {
893  }
894  else if (VARATT_IS_SHORT(attr))
895  {
896  result = VARSIZE_SHORT(attr);
897  }
898  else
899  {
900  /*
901  * Attribute is stored inline either compressed or not, just calculate
902  * the size of the datum in either case.
903  */
904  result = VARSIZE(attr);
905  }
906  return result;
907 }
#define VARATT_IS_EXTERNAL_ONDISK(PTR)
Definition: postgres.h:314
#define VARATT_IS_EXTERNAL_EXPANDED(PTR)
Definition: postgres.h:322
#define VARSIZE(PTR)
Definition: postgres.h:303
#define VARATT_EXTERNAL_GET_POINTER(toast_pointer, attr)
Definition: detoast.h:32
#define PointerGetDatum(X)
Definition: postgres.h:556
static struct @145 value
Size toast_datum_size(Datum value)
Definition: detoast.c:862
#define VARATT_IS_EXTERNAL_INDIRECT(PTR)
Definition: postgres.h:316
#define VARATT_IS_SHORT(PTR)
Definition: postgres.h:326
Size EOH_get_flat_size(ExpandedObjectHeader *eohptr)
Definition: expandeddatum.c:75
#define VARSIZE_SHORT(PTR)
Definition: postgres.h:305
ExpandedObjectHeader * DatumGetEOHP(Datum d)
Definition: expandeddatum.c:29
#define Assert(condition)
Definition: c.h:732
size_t Size
Definition: c.h:466
#define DatumGetPointer(X)
Definition: postgres.h:549
Definition: c.h:549

◆ toast_raw_datum_size()

Size toast_raw_datum_size ( Datum  value)

Definition at line 806 of file detoast.c.

References Assert, DatumGetEOHP(), DatumGetPointer, EOH_get_flat_size(), varatt_indirect::pointer, PointerGetDatum, toast_raw_datum_size(), varatt_external::va_rawsize, VARATT_EXTERNAL_GET_POINTER, VARATT_IS_COMPRESSED, VARATT_IS_EXTERNAL_EXPANDED, VARATT_IS_EXTERNAL_INDIRECT, VARATT_IS_EXTERNAL_ONDISK, VARATT_IS_SHORT, VARHDRSZ, VARHDRSZ_SHORT, VARRAWSIZE_4B_C, VARSIZE, and VARSIZE_SHORT.

Referenced by bpcharoctetlen(), build_sorted_items(), byteaeq(), byteane(), byteaoctetlen(), compute_array_stats(), compute_distinct_stats(), compute_scalar_stats(), datum_image_eq(), record_image_cmp(), text_length(), text_starts_with(), texteq(), textne(), textoctetlen(), and toast_raw_datum_size().

807 {
808  struct varlena *attr = (struct varlena *) DatumGetPointer(value);
809  Size result;
810 
811  if (VARATT_IS_EXTERNAL_ONDISK(attr))
812  {
813  /* va_rawsize is the size of the original datum -- including header */
814  struct varatt_external toast_pointer;
815 
816  VARATT_EXTERNAL_GET_POINTER(toast_pointer, attr);
817  result = toast_pointer.va_rawsize;
818  }
819  else if (VARATT_IS_EXTERNAL_INDIRECT(attr))
820  {
821  struct varatt_indirect toast_pointer;
822 
823  VARATT_EXTERNAL_GET_POINTER(toast_pointer, attr);
824 
825  /* nested indirect Datums aren't allowed */
826  Assert(!VARATT_IS_EXTERNAL_INDIRECT(toast_pointer.pointer));
827 
828  return toast_raw_datum_size(PointerGetDatum(toast_pointer.pointer));
829  }
830  else if (VARATT_IS_EXTERNAL_EXPANDED(attr))
831  {
833  }
834  else if (VARATT_IS_COMPRESSED(attr))
835  {
836  /* here, va_rawsize is just the payload size */
837  result = VARRAWSIZE_4B_C(attr) + VARHDRSZ;
838  }
839  else if (VARATT_IS_SHORT(attr))
840  {
841  /*
842  * we have to normalize the header length to VARHDRSZ or else the
843  * callers of this function will be confused.
844  */
845  result = VARSIZE_SHORT(attr) - VARHDRSZ_SHORT + VARHDRSZ;
846  }
847  else
848  {
849  /* plain untoasted datum */
850  result = VARSIZE(attr);
851  }
852  return result;
853 }
#define VARATT_IS_EXTERNAL_ONDISK(PTR)
Definition: postgres.h:314
#define VARATT_IS_COMPRESSED(PTR)
Definition: postgres.h:312
#define VARATT_IS_EXTERNAL_EXPANDED(PTR)
Definition: postgres.h:322
#define VARHDRSZ_SHORT
Definition: postgres.h:268
#define VARSIZE(PTR)
Definition: postgres.h:303
#define VARATT_EXTERNAL_GET_POINTER(toast_pointer, attr)
Definition: detoast.h:32
#define PointerGetDatum(X)
Definition: postgres.h:556
#define VARHDRSZ
Definition: c.h:555
static struct @145 value
#define VARATT_IS_EXTERNAL_INDIRECT(PTR)
Definition: postgres.h:316
#define VARATT_IS_SHORT(PTR)
Definition: postgres.h:326
Size EOH_get_flat_size(ExpandedObjectHeader *eohptr)
Definition: expandeddatum.c:75
Size toast_raw_datum_size(Datum value)
Definition: detoast.c:806
#define VARSIZE_SHORT(PTR)
Definition: postgres.h:305
ExpandedObjectHeader * DatumGetEOHP(Datum d)
Definition: expandeddatum.c:29
#define VARRAWSIZE_4B_C(PTR)
Definition: postgres.h:283
#define Assert(condition)
Definition: c.h:732
size_t Size
Definition: c.h:466
#define DatumGetPointer(X)
Definition: postgres.h:549
Definition: c.h:549