type

CHAR

Fixed-length character data in PostgreSQL is blank padded. Trailing spaces have special comparison behavior; it is not a performance shortcut. Example target: PostgreSQL 17. Run in a disposable database; examples need no existing tables.

Formal Syntax & Structure

sql syntaxsql
CHAR(n)

Working Example

Example Snippetsql
SELECT CHAR_LENGTH(CAST('AB' AS CHAR(5)));
SQL Reference