Обсуждение: Char datatype

Поиск
Список
Период
Сортировка

Char datatype

От
Andre Restivo
Дата:
Hi,

Does anyone know why does pg use 4+n bytes to store a char(n) field? The
four initial bytes seem to have only null chars so why are they used?

Thx

Andre Restivo

Re: Char datatype

От
Bruce Momjian
Дата:
[ Charset ISO-8859-15 unsupported, converting... ]
> Hi,
>
> Does anyone know why does pg use 4+n bytes to store a char(n) field? The
> four initial bytes seem to have only null chars so why are they used?

The 4 bytes is for the length of the string to be stored.

--
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026