Re: Currval not working - Mailing list pgsql-odbc

From Chris Gamache
Subject Re: Currval not working
Date
Msg-id 20030602163505.55124.qmail@web13803.mail.yahoo.com
Whole thread Raw
In response to Currval not working  ("Patrick Hatcher" <pathat@attbi.com>)
List pgsql-odbc
Currval is defined if the sequence is incremented during the connection. If you
want the current value of the sequence regardless of whether our not it was
updated this session (PostgreSQL 7.2) :

SELECT last_value FROM hodiv_hodiv_id_seq;

Beware: This value has a completely different meaning than currval. Currval is
basicly the last (updated) value of the sequence for the connection. AFAIK,
last_value will return the value of the sequence at the moment of the query,
and is subject to be changed by concurrent connections.

Make sure you have SELECT permissions for the sequence.

HTH,

CG




--- Patrick Hatcher <pathat@attbi.com> wrote:
> PG: 7.3.3
> Driver version: 7.03.01
>
> I'm using VB as a front-end to end data into PG database.  When I try to pull
> the current value of my serial field using this code:
> rs.open "select currval('public.hodiv_hodiv_id_seq');",CN
> I get this error message:
> ERROR: hodiv_hodiv_id_seq.currval is not yet defined in this session.
> However, if use nextval it works fine.
> rs.open "select nextval('public.hodiv_hodiv_id_seq');",CN
>
> Any ideas?
>
> TIA
> Patrick
>
>
>


__________________________________
Do you Yahoo!?
Yahoo! Calendar - Free online calendar with sync to Outlook(TM).
http://calendar.yahoo.com

pgsql-odbc by date:

Previous
From: "Dave Page"
Date:
Subject: Re: WIN ODBC 7.03.01.0000 & MD5
Next
From: Jeff Silberberg
Date:
Subject: WIN ODBC 7.03.01.0000 & MD5