Re: Char datatype - Mailing list pgsql-admin

From Bruce Momjian
Subject Re: Char datatype
Date
Msg-id 200010120302.XAA02812@candle.pha.pa.us
Whole thread Raw
In response to Char datatype  (Andre Restivo <arestivo@criticalsoftware.com>)
List pgsql-admin
[ 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

pgsql-admin by date:

Previous
From: Lamar Owen
Date:
Subject: Re: PostgreSQL encoding question
Next
From: Loïc TREGOUËT
Date:
Subject: ERROR: ORDER BY is not allowed in INSERT/SELECT