Problems Retrieving The Content Of Columns Of Type TEXT from PostgreSQL - No Data Returned and Sqlstate 01004 in Trace File. (Doc ID 1425906.1)

Last updated on JANUARY 18, 2017

Applies to:

Oracle Database - Enterprise Edition - Version 11.2.0.1 and later
Information in this document applies to any platform.

Symptoms

DG4ODBC is used to connect to PostgreSQL. A query like the following returns nothing, though there is data in the table column -

SQL> SELECT "text_col" FROM "postgresql_table"@dblink_to_postgresql


The column "text_col" is of type TEXT. The problem does not happen on VARCHAR columns.

The gateways trace file shows an output like the following:

DTY NULL-OK LEN MAXBUFLEN PR/SC CST IND MOD NAME
12 VARCHAR Y 0 0 0/ 0 0 0 200 text_col
Entered hgopoer at 2012/02/14-14:40:46
hgopoer, line 233: got native error -2 and sqlstate 01004; message follows...
Fetched item was truncated. {01004,NativeErr = -2}
Exiting hgopoer, rc=0 at 2012/02/14-14:40:46
hgoftch, line 740: calling SQLFetch got sqlstate 01004

...

SQLBindCol: column 1, cdatatype: 1, bflsz: 1


And the ODBC trace file shows something like this:

[ODBC][23164][SQLBindCol.c][165]
Entry:
Statement = 0xc04efa0
Column Number = 1
Target Type = 1 SQL_CHAR
Target Value = 0xc078a08
Buffer Length = 1
StrLen Or Ind = 0xc07df90

Cause

Sign In with your My Oracle Support account

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

My Oracle Support provides customers with access to over a
Million Knowledge Articles and hundreds of Community platforms