skip to main content
Part 2: The 32-Bit/64-Bit Drivers : The PostgreSQL Wire Protocol Driver : Data Types
  
Data Types
The following table shows how the PostgreSQL data types are mapped to the standard ODBC data types. Using the XML Data Type describes PostgreSQL to Unicode data type mappings.
Table 27. PostgreSQL Data Types
PostgreSQL
ODBC
Bigint
SQL_BIGINT
Bigserial
SQL_BIGINT
Bit1
SQL_BIT
Bit varying
SQL_VARBINARY
Boolean
SQL_BIT
Bytea
SQL_VARBINARY
Character
SQL_CHAR
Character varying
SQL_VARCHAR
Date
SQL_TYPE_DATE
Decimal
SQL_DECIMAL
Double Precision
SQL_DOUBLE
Integer
SQL_INTEGER
Money
SQL_VARCHAR
Name
SQL_VARCHAR
Numeric2
SQL_NUMERIC
Real
SQL_REAL
Serial
SQL_INTEGER
Smallint
SQL_SMALLINT
Text
SQL_LONGVARCHAR
Time3
SQL_TYPE_TIME
Timestamp
SQL_TYPE_TIMESTAMP
Timestamp with timezone4
SQL_VARCHAR
XML
SQL_WLONGVARCHAR

1 Bit maps to SQL_BIT when the length for the bit is 1. If the length is greater than 1, the driver maps the column to SQL_BINARY.

2 Numeric maps to SQL_NUMERIC if the precision of the Numeric is less than or equal to 38. If the precision is greater than 38, the driver maps the column to SQL_VARCHAR.

3 Time mapping changes based on the setting of the Fetch TWFS as Time option

4 Timestamp with timezone mapping changes based on the setting of the Fetch TSWTZ as Timestamp option.

See Retrieving Data Type Information for more information about data types.
* Using the XML Data Type