Unsupported versions: 6.3
This documentation is for an unsupported version of PostgreSQL.
You may want to view the same page for the current version, or one of the other supported versions listed above instead.
Prev Chapter 8. Data Types Next

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 8-5. Postgres Character Types

Character Type Storage Recommendation Description
char 1 byte SQL92-compatible Single character
char(n) (4+n) bytes SQL92-compatible Fixed-length blank padded
text (4+x) bytes Best choice Variable-length
varchar(n) (4+n) bytes SQL92-compatible Variable-length with limit

There are currently other fixed-length character types. These provide no additional functionality and are likely to be deprecated in the future.

Table 8-6. Postgres Specialty Character Types

Character Type Storage Description
char2 2 bytes Two characters
char4 4 bytes Four characters
char8 8 bytes Eight characters
char16 16 bytes Sixteen characters

Prev Home Next
Monetary Type Up Date/Time Types