pg.ddx.io  pgsql-odbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Alain Picard <Alain.Picard@memetrics.com>
To: pgsql-odbc@postgresql.org
Cc: alain.picard@memetrics.com
Subject: ODBC breaks COUNTS, SEQUENCES as of Postgresql 7.3
Date: Mon, 3 Feb 2003 11:06:49 +1100 (EST)
Message-ID: <15933.45721.965448.55685@outback.memetrics.local> (raw)


Dear ODBC users,

I have an application, written in lisp, which uses the unixODBC
driver manager (though I've tested what follows with iODBC, with
the same results).  I have no real control over how the ODBC library
is being used in this application; it comes from a 3rd party vendor.
I'm trying to reverse engineer what they do via customer support and
inspecting the ODBC trace log files.


On the the problem.
With versions of Postgresql <= 7.2, I would obtain the following
results,

    (select [count [*]] :from [foo])
     => 
    ((73))
    ("count")


As of 7.3, I am now obtaining 

    (select [count [*]] :from [foo])
     => 
    (("73"))
    ("count")

Note the 73 is now "73".  My understanding is that this is because as
of 7.3, postgresql now reports counts, sequences, etc as INTEGER8,
whereas they were previously INTEGER4.  

I tried to switch to using the "official" postgresql ODBC driver,
psqlodbc, and compiled it from the sources in CVS.  My thinking is
that they would track the changes in Postgresql more closely than the
unixODBC group.  

Setting up a DSN to use this driver, I can no longer connect to the
back end:

    XOS 23 > (connect "test_new_postgres/kooks")
    Error: Sql-Database-Data-Error id HY092[28] : [unixODBC]ColAttribute for this type not implemented yet
      1 (abort) Return to level 0.
      2 Return to top loop level 0.

    Type :b for backtrace, :c <option number> to proceed,  or :? for other options

The SQL log file of unixODBC shows:

    [ODBC][7481][SQLColAttributes.c][226]
		    Entry:            
			    Statement = 0x806cda0            
			    Column Number = 1            
			    Field Identifier = 0            
			    Character Attr = 0x807c168            
			    Buffer Length = 4            
			    String Length = 0x805cd96            
			    Numeric Attribute = 0x805cd90

    [ODBC][7481][SQLColAttributes.c][553]
		    Exit:[SQL_ERROR]
		    DIAG [HY092] [unixODBC]ColAttribute for this type not implemented yet

    [ODBC][7481][SQLError.c][310]
		    Entry:                
			    Statement = 0x806cda0                
			    SQLState = 0x807c178                
			    Native = 0x805cd94                
			    Message Text = 0x807c698                
			    Buffer Length = 512                
			    Text Len Ptr = 0x805cd92

Which seems to be being raised at line 740 of results.c
(as of revision 1.57) in function PGAPI_ColAttributes.
At this point, the code is trying to map the fDescType.

Note that the Field Identifier = 0 seems to correspond
to an input for fDescType of SQL_COLUMN_COUNT.

There is a commented out case at line 558 which says
that SQL_COLUMN_COUNT is "handled above", however, it seems
that in fact, it is not handled, as the code eventually falls
through to the default case and prints the error message
detailed above.


Does anybody know:
 a) how to fix this?
 b) how to get 7.3 to return numbers via ODBC
 c) if I'm just totally confused?  :-)


Thanks for any input.


--
			Alain Picard
			Memetrics



view thread (2+ messages)  latest in thread

Message-ID: <15933.45721.965448.55685@outback.memetrics.local>
Permalink:  ../15933.45721.965448.55685@outback.memetrics.local/
Also on:    postgresql.org/message-id/15933.45721.965448.55685@outback.memetrics.local

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-odbc@postgresql.org
  Cc: Alain.Picard@memetrics.com
  Subject: Re: ODBC breaks COUNTS, SEQUENCES as of Postgresql 7.3
  In-Reply-To: <15933.45721.965448.55685@outback.memetrics.local>
  References: <15933.45721.965448.55685@outback.memetrics.local>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox