Re: range data type size not mention in docs.

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: Jian He <hejian(dot)mark(at)gmail(dot)com>
Cc: "pgsql-docs(at)lists(dot)postgresql(dot)org" <pgsql-docs(at)lists(dot)postgresql(dot)org>
Subject: Re: range data type size not mention in docs.
Date: 2022-02-17 06:51:02
Message-ID: CAKFQuwYXFimG=bBeR9DSWVKK8at_+s_eBbcXDtMuyP38xa0R7Q@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-docs

On Wednesday, February 16, 2022, Jian He <hejian(dot)mark(at)gmail(dot)com> wrote:

>
> range type seem not mention their size in the docs.
> multi range size is variable.
> But range size seems fixed.
> why it's 17 byte?
>
> select pg_column_size('[10,20)' ::int4range ); --17 byte
> select pg_column_size('[-2147483648,2147483647)' ::int4range ); --17 byte.
>
> https://github.com/postgres/postgres/blob/4429f6a9e3e12bb4af6e3677fbc78cd80f160252/src/backend/utils/adt/rangetypes.c#L183

* Binary representation: The first byte is the flags, then 4 bytes are the
* range type Oid, then the lower bound (if present) then the upper bound (if
* present). Each bound is represented by a 4-byte length header and the binary
* representation of that bound (as returned by a call to the send function for
* the subtype).

David J.

In response to

Browse pgsql-docs by date

  From Date Subject
Next Message PG Doc comments form 2022-02-18 01:19:46 Copy Documentation
Previous Message Jian He 2022-02-17 06:09:55 range data type size not mention in docs.