From: Chris Gamache <cgg007@yahoo.com>
To: Patrick Hatcher <pathat@attbi.com>
To: pgsql-odbc@postgresql.org
Subject: Re: Currval not working
Date: Mon, 2 Jun 2003 09:35:05 -0700 (PDT)
Message-ID: <20030602163505.55124.qmail@web13803.mail.yahoo.com> (raw)
In-Reply-To: <000a01c326ee$dcd67520$02120a0a@D7MKWD21>
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
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: cgg007@yahoo.com, pathat@attbi.com
Subject: Re: Currval not working
In-Reply-To: <20030602163505.55124.qmail@web13803.mail.yahoo.com>
References: <000a01c326ee$dcd67520$02120a0a@D7MKWD21> <20030602163505.55124.qmail@web13803.mail.yahoo.com>
* 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