My Oracle Support Banner

Select Statement Using Dg4odbc Gateway To Postgres Not Showing Correct Data For Large Values (Doc ID 1263666.1)

Last updated on SEPTEMBER 27, 2019

Applies to:

Oracle Database - Enterprise Edition - Version to [Release 11.2]
Oracle Database Cloud Schema Service - Version N/A and later
Oracle Database Exadata Express Cloud Service - Version N/A and later
Oracle Database Exadata Cloud Machine - Version N/A and later
Oracle Cloud Infrastructure - Database Service - Version N/A and later
Information in this document applies to any platform.


Selecting a number data type from a Postgres database using Database Gateway for ODBC (DG4ODBC) and the Postgres ODBC driver in some cases is returning incorrect data for very large values.

For example:

From Postgres, not using DG4ODBC -

select * from mytable where mynumber = 68

id1 |id2 |mynumber
20089 |188895 |68
20067 |188780 |68
21155 |193296 |68
21330 |194066 |68

result set 1 returned 4 rows.

From Oracle SQL*Plus using DG4ODBC -

SQL> select * from "mytable"@mydblink where "mynumber" = 68;
----------------------- ----------------------- -----------------------
86187108748921 810803926327775 292057776196
90860033166947 830199998636396 292057776196
91611652444835 833507123458832 292057776196
21330 194066 68

The Postgres columns are created as "integer NOT NULL"

A SQLPLUS describe shows the table as:

id1         NOT NULL NUMBER(10)
id2         NOT NULL NUMBER(10)
mynumber    NOT NULL NUMBER(10)

The odbc driver being used for the connection is the Openlink odbc driver.


To view full details, sign in with your My Oracle Support account.

Don't have a My Oracle Support account? Click to get started!

In this Document

My Oracle Support provides customers with access to over a million knowledge articles and a vibrant support community of peers and Oracle experts.