BUG #3030: Unable to query SQL_WCHAR column via ODBC - Mailing list pgsql-bugs

From Dr. Axel Reimann
Subject BUG #3030: Unable to query SQL_WCHAR column via ODBC
Date
Msg-id 200702191343.l1JDhI0g024894@wwwmaster.postgresql.org
Whole thread Raw
List pgsql-bugs
The following bug has been logged online:

Bug reference:      3030
Logged by:          Dr. Axel Reimann
Email address:      axel.privat@web.de
PostgreSQL version: 8.1.8
Operating system:   Gentoo Linux, Kernel 2.6.19, glibc 2.5
Description:        Unable to query SQL_WCHAR column via ODBC
Details:

I created a table via:

CREATE TABLE publisher
(
  name character varying(80) NOT NULL,
  address text,
  CONSTRAINT publisher_pkey PRIMARY KEY (name)
)
WITHOUT OIDS;
ALTER TABLE publisher OWNER TO postgres;

whereas the database encoding is set to UTF8 and
inserted some data, lets say:
'New Publisher' 'new address'

If I query that table, e.g. via pgAdmin's query tool,
I can easily retrieve the entered information.
Running a corresponding query from an ODBC application,
I get the following 'unsupported type' error:

[ODBC][11736][SQLExecDirectW.c][138]
                Entry:
                        Statement = 0x83f2820
                        SQL = [SELECT Name FROM Publisher][length = 26
(SQL_NTS)]
[ODBC][11736][SQLExecDirectW.c][396]
                Exit:[SQL_SUCCESS]
[ODBC][11736][SQLBindCol.c][222]
                Entry:
                        Statement = 0x83f2820
                        Column Number = 1
                        Target Type = -8 SQL_WCHAR
                        Target Value = 0xbfd29a4c
                        Buffer Length = 1024
                        StrLen Or Ind = 0xbfd29e54
[ODBC][11736][SQLBindCol.c][326]
                Exit:[SQL_SUCCESS]
[ODBC][11736][SQLFetch.c][158]
                Entry:
                        Statement = 0x83f2820
[ODBC][11736][SQLFetch.c][340]
                Exit:[SQL_ERROR]
                DIAG [07006] Received an unsupported type from Postgres

The connection was made via ODBC's SQLConnectW function
and returned:

[ODBC][11609][SQLConnectW.c][159]
                Entry:
                        Connection = 0x83eac28
                        Server Name = [LiLiDaB (local PG)][length = 18
(SQL_NTS)]
                        User Name = [postgres][length = 8 (SQL_NTS)]
                        Authentication = [******][length = 6 (SQL_NTS)]
                UNICODE Using encoding ASCII 'ISO8859-1' and UNICODE
'UCS-2LE'

pgsql-bugs by date:

Previous
From: Pelle Johansson
Date:
Subject: Re: BUG #3012: Wrong JOIN order when a JOIN depends on result from a LEFT JOIN.
Next
From: "Luigi Tarenga"
Date:
Subject: BUG #3033: performance issue with self join