This page in other versions: Unsupported versions: 6.3
PostgreSQL
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
Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group