Re: Problem getting sequences under 8.02.03.00 driver

From: Andreas <maps(dot)on(at)gmx(dot)net>
To: Eric E <whalesuit(at)gmail(dot)com>
Cc: pgsql-odbc(at)postgresql(dot)org
Subject: Re: Problem getting sequences under 8.02.03.00 driver
Date: 2007-07-10 13:00:44
Message-ID: 469382FC.6020707@gmx.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-odbc

Eric E schrieb:
> Hi all,
> I installed the 8.02.03.00 driver during my installation of
> Postgres 8.2 onto my machine. After installation of that driver, the
> following code related to sequences would not work:
[...]
> Where sSequenceName is holding the name of a sequence in the
> search_path visible to the connection. The problem is that the value
> returned from the ADODB Recordset is always 0. I can get a sequence
> perfectly well using pgAdmin, and logs of statements showed that the
> driver was in fact executing the SELECT nextval statement. I can also
> execute other SELECT statements just fine using the Connection and
> Recordset objects. For some reason, however, sequence values are
> always returned as 0.

Maybe it's because you define the resulting type as text?

I've installed latest ODBC V8.0.2.04.01 and there a similar query works.

Dim objRstADO As ADODB.Recordset

Set objRstADO = objConnADO.Execute("SELECT nextval('" &
strSequenceName & "')", , adLockReadOnly)
debug.print Nz(objRstADO(0), 0)

Is the Login-role in the connectionstring the same as you use in pgAdmin?
Perhaps - ok, not very likely - is your ADO connection just not allowed
to see the sequence.
Depending on your function's error handler there could be a hidden error
condition and the function delivers the default value for numeric types = 0.

In response to

Responses

Browse pgsql-odbc by date

  From Date Subject
Next Message Harpreet Dhaliwal 2007-07-10 17:57:59 Re: Duplicate Unique Key constraint error
Previous Message Ludek Finstrle 2007-07-10 09:02:15 Re: ChangeLog?