pg.ddx.io  pgsql-odbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
ODBC breaks COUNTS, SEQUENCES as of Postgresql 7.3
2+ messages / 2 participants
[nested] [flat]

* ODBC breaks COUNTS, SEQUENCES as of Postgresql 7.3
@ 2003-02-03 00:06  Alain Picard <Alain.Picard@memetrics.com>
  0 siblings, 1 reply; 2+ messages in thread

From: Alain Picard @ 2003-02-03 00:06 UTC (permalink / raw)
  To: pgsql-odbc; +Cc: alain.picard@memetrics.com


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



^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: ODBC breaks COUNTS, SEQUENCES as of Postgresql 7.3
@ 2003-02-03 00:37  Tom Lane <tgl@sss.pgh.pa.us>
  parent: Alain Picard <Alain.Picard@memetrics.com>
  0 siblings, 0 replies; 2+ messages in thread

From: Tom Lane @ 2003-02-03 00:37 UTC (permalink / raw)
  To: Alain Picard <Alain.Picard@memetrics.com>; +Cc: pgsql-odbc

Alain Picard <Alain.Picard@memetrics.com> writes:
>  b) how to get 7.3 to return numbers via ODBC

I dunno anything about fixing ODBC, but the standard advice for avoiding
client-side problems with int8 is to cast the result of count(*) back to
int4:

	select count(*)::integer from ...

			regards, tom lane



^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2003-02-03 00:37 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2003-02-03 00:06 ODBC breaks COUNTS, SEQUENCES as of Postgresql 7.3 Alain Picard <Alain.Picard@memetrics.com>
2003-02-03 00:37 ` Tom Lane <tgl@sss.pgh.pa.us>

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