Re: What's the prefix?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "jacktby(at)gmail(dot)com" <jacktby(at)gmail(dot)com>
Cc: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>, pgsql-hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: What's the prefix?
Date: 2023-02-27 02:18:55
Message-ID: 152580.1677464335@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

"jacktby(at)gmail(dot)com" <jacktby(at)gmail(dot)com> writes:
>> text is variable length so there is header information built into the datatype representation that indicates how long the content is.

David's statement is accurate.

> No, this is the varlena struct:
> struct varlena
> {
> char vl_len_[4]; /* Do not touch this field directly! */
> char vl_dat[FLEXIBLE_ARRAY_MEMBER]; /* Data content is here */

This struct only accurately describes "untoasted" varlenas.
The one you are looking at is a "short header" varlena;
see varattrib_1b and nearby comments in src/include/varatt.h,
or in postgres.h if you're not looking at current HEAD branch.

regards, tom lane

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Jeff Davis 2023-02-27 03:36:17 Re: allow meson to find ICU in non-standard localtion
Previous Message jacktby@gmail.com 2023-02-27 02:04:09 Re: Re: What's the prefix?