public inbox for [email protected]  
help / color / mirror / Atom feed
range data type size not mention in docs.
2+ messages / 2 participants
[nested] [flat]

* range data type size not mention in docs.
@ 2022-02-17 06:09  Jian He <[email protected]>
  0 siblings, 1 reply; 2+ messages in thread

From: Jian He @ 2022-02-17 06:09 UTC (permalink / raw)
  To: [email protected]

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.


^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: range data type size not mention in docs.
@ 2022-02-17 06:51  David G. Johnston <[email protected]>
  parent: Jian He <[email protected]>
  0 siblings, 0 replies; 2+ messages in thread

From: David G. Johnston @ 2022-02-17 06:51 UTC (permalink / raw)
  To: Jian He <[email protected]>; +Cc: [email protected] <[email protected]>

On Wednesday, February 16, 2022, Jian He <[email protected]> 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...

* 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.


^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2022-02-17 06:51 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2022-02-17 06:09 range data type size not mention in docs. Jian He <[email protected]>
2022-02-17 06:51 ` David G. Johnston <[email protected]>

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox