Ispirer Website Ispirer Capabilities - PostgreSQL Migration Free Trial

PostgreSQL Data Types - VARCHAR

Versions: PostgreSQL 8.x and 7.x

PostgreSQL - VARCHAR
Syntax VARCHAR[(n)]
Data Variable-length character data, single-byte and multibyte character sets
Parameters n is the maximum number of characters, optional
Range 1 ⇐ n ⇐ 1G
Default n is 1G
Padding Not right-padded with spaces to n
Trailing Spaces Not removed when the value is stored and retrieved. Trailing spaces are significant in comparison.
Character Set Database default
Error Handling Exceeding data truncated to the maximum length if the excess characters are all spaces, otherwise an error is raised. Casting to a shorter length truncates
the value without raising an error.
Storage Size actual entry length
Synonyms CHARACTER VARYING
Standards ANSI SQL

PostgreSQL VARCHAR - Equivalents in Other Databases

Database Data Type and Conversion
Oracle VARCHAR2(n), 1 ⇐ n ⇐ 4000/charsize; NVARCHAR2(n), 1 ⇐ n ⇐ 4000/charsize, Unicode - UTF-8 or UTF-16
SQL Server VARCHAR(n | max), 1 ⇐ n ⇐ 8000, 2G if max is specified
MySQL VARCHAR(n), 1 ⇐ n ⇐ 65535/charsize; NVARCHAR(n), 1 ⇐ n ⇐ 21845, Unicode - UTF-8
Sybase ASE VARCHAR(n), 1 ⇐ n ⇐ pagesize (2K, 4K, 8K or 16K); NVARCHAR(n), 1 ⇐ n ⇐ pagesize/@@ncharsize;
UNIVARCHAR(n), 1 ⇐ n ⇐ pagesize/@@unicharsize, Unicode
Informix VARCHAR(n,r), 1 ⇐ n ⇐ 255, LVARCHAR(n), 1 ⇐ n ⇐ 32739, TEXT, 2G, CLOB, 4T
HP Neoview VARCHAR(n), 1 ⇐ n ⇐ (32708 - size of other columns)
Ingres VARCHAR(n), 1 ⇐ n ⇐ 32000; NVARCHAR(n), 1 ⇐ n ⇐ 16000, Unicode - UTF-8;
TEXT(n), 1 ⇐ n ⇐ 32000

Related Data Types in PostgreSQL

Data Types
Fixed-length character data CHAR(n)
Variable-length character data TEXT

All Data Types


© 1999-2024, Ispirer Systems, LLC. All Rights Reserved.