type

VARCHAR

Variable-length text with a declared character limit in PostgreSQL. An explicit cast may truncate an overlong value; do not confuse this with insertion behavior. Example target: PostgreSQL 17. Run in a disposable database; examples need no existing tables.

Formal Syntax & Structure

sql syntaxsql
VARCHAR(n)

Working Example

Example Snippetsql
SELECT CAST(CAST('ABCDE' AS VARCHAR(3)) AS TEXT);
SQL Reference