Реклама:

info.krc.karelia.ru

win -:|:- koi -:|:- iso -:|:- dos -:|:- mac

Start -:|:- Проекты -:|:- О нас

Character Types

SQL92 defines two primary character types: char and varchar. Postgres supports these types, in addition to the more general text type, which unlike varchar does not require an upper limit to be declared on the size of the field.

Table 2-5. Postgres Character Types

Character TypeStorageRecommendationDescription
char1 byteSQL92-compatibleSingle character
char(n)(4+n) bytesSQL92-compatibleFixed-length blank padded
text(4+x) bytesBest choiceVariable-length
varchar(n)(4+n) bytesSQL92-compatibleVariable-length with limit

There is one other fixed-length character type. The name type only has one purpose and that is to provide Postgres with a special type to use for internal names. It is not intended for use by the general user. It's length is currently defined as 32 chars but should be reference using NAMEDATALEN. This is set at compile time and may change in a future release.

Table 2-6. Postgres Specialty Character Type

Character TypeStorageDescription
name32 bytesThirty-two character internal type