Character Types

SQL defines two primary character types: character and character varying. PostgreSQL supports these types, in addition to the more general text type, which unlike character varying does not require an explicit declared upper limit on the size of the field.

Refer to the Section called String Constants in Chapter 1 for information about the syntax of string literals, and to Chapter 3 for information about available operators and functions.

Table 2-3. Character Types

Type NameStorageRecommendationDescription
character(n), char(n)(4+n) bytesSQL-compatibleFixed-length blank padded
character varying(n), varchar(n)(4+n) bytesSQL-compatibleVariable-length with limit
text(4+n) bytesMost flexibleVariable unlimited length

Note

Although the type text is not SQL-compliant, many other RDBMS packages implement it as well.