Ispirer Ispirer
 


Ispirer Home Page Ispirer SQLWays Product Page - Migration to PostgreSQL Request SQLWays

PostgreSQL Data Types - CHAR

Versions: PostgreSQL 8.x and 7.x

PostgreSQL - CHAR
Syntax CHAR[(n)]
Data Fixed-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 1
Padding Right-padded with spaces to n
Trailing Spaces Removed when the value is retrieved. Trailing spaces are insignificant 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 n bytes
Synonyms CHARACTER
Standards ANSI SQL

PostgreSQL CHAR - Equivalents in Other Databases

Database Data Type and Conversion
Oracle CHAR(n), 1 ⇐ n ⇐ 2000/charsize; NCHAR(n), 1 ⇐ n ⇐ 2000/charsize, Unicode - UTF-8 or UTF-16
SQL Server CHAR(n), 1 ⇐ n ⇐ 8000; NCHAR(n), 1 ⇐ n ⇐ 4000, Unicode - UCS-2
IBM DB2 CHAR(n), 1 ⇐ n ⇐ 254; GRAPHIC(n), 1 ⇐ n ⇐ 127, double-byte
MySQL CHAR(n), 0 ⇐ n ⇐ 255; NCHAR(n), 0 ⇐ n ⇐ 255, Unicode - UTF-8
Sybase ASE CHAR(n), 1 ⇐ n ⇐ pagesize (2K, 4K, 8K or 16K); NCHAR(n), 1 ⇐ n ⇐ pagesize; UNICHAR(n), 1 ⇐ n ⇐ pagesize, Unicode
Sybase ASA CHAR(n), 1 ⇐ n ⇐ 32767/charsize; NCHAR(n), 1 ⇐ n ⇐ 8191, Unicode - UTF-8
Informix DS CHAR(n), 1 ⇐ n ⇐ 32767; NCHAR(n), 1 ⇐ n ⇐ 32767, database character set
Teradata CHAR(n), 1 ⇐ n ⇐ 64000/charsize
HP Neoview CHAR(n), 1 ⇐ n ⇐ (32708 - size of other columns); NCHAR(n), 1 ⇐ n ⇐ (32708 - size of other columns), Unicode - UCS-2 or ISO88591 (Latin1)
Interbase/Firebird CHAR(n), 1 ⇐ n ⇐ 32767/charsize; NCHAR(n), 1 ⇐ n ⇐ 32767, single-byte ISO8859_1 (Latin 1)
Ingres CHAR(n), 1 ⇐ n ⇐ 3200; NCHAR(n), 1 ⇐ n ⇐ 16000, Unicode - UTF-8

Related Data Types in PostgreSQL

Data Types
Variable-length character data VARCHAR(n) TEXT

All Data Types


Ispirer Home Page Ispirer SQLWays Product Page - Migration to PostgreSQL Request SQLWays

sqlways/postgresql/data-types/char.txt · Last modified: April 03, 2013, 04:21:03 AM by leonov
 
Ispirer Ispirer © 1999-2014, Ispirer Systems Ltd.
All Rights Reserved.  Privacy Statement