Character types

The following table shows the various character types:

Name Comments Trailing spaces Maximum length
char Equivalent to char(1), it must be quoted as shown in the name. Semantically insignificant 1
name Equivalent to varchar(64). Used by Postgres for object names. Semantically significant 64
char(n) Alias: character(n). Fixed-length character where the length is n. Internally called blank padded character (bpchar). Semantically insignificant 1 to 10485760
varchar(n) Alias: character varying(n). Variable-length character where the maximum length is n. Semantically significant 1 to 10485760
text Variable-length character. Semantically significant Unlimited

PostgreSQL provides two general text types—the ...

Get Learning PostgreSQL 11 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.