From pathat@attbi.com Fri May 30 21:03:06 2003 X-Original-To: pgsql-odbc@postgresql.org Received: from localhost (developer.postgresql.org [64.117.224.193]) by developer.postgresql.org (Postfix) with ESMTP id 42610925D9D for ; Fri, 30 May 2003 17:03:06 -0400 (EDT) Received: from developer.postgresql.org ([64.117.224.193]) by localhost (developer.postgresql.org [64.117.224.193:10024]) (amavisd-new) with ESMTP id 10868-07 for ; Fri, 30 May 2003 17:03:01 -0400 (EDT) Received: from sccrmhc01.attbi.com (sccrmhc01.attbi.com [204.127.202.61]) by developer.postgresql.org (Postfix) with ESMTP id 2975B925D93 for ; Fri, 30 May 2003 17:03:01 -0400 (EDT) Received: from d7mkwd21 (12-233-90-196.client.attbi.com[12.233.90.196]) by attbi.com (sccrmhc01) with SMTP id <2003053021030000100hrshre>; Fri, 30 May 2003 21:03:00 +0000 Message-ID: <000a01c326ee$dcd67520$02120a0a@D7MKWD21> From: "Patrick Hatcher" To: Subject: Currval not working Date: Fri, 30 May 2003 14:03:03 -0700 MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_NextPart_000_0007_01C326B4.300EC930" X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2800.1158 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 X-Virus-Scanned: by amavisd-new X-Archive-Number: 200305/74 X-Sequence-Number: 2974 This is a multi-part message in MIME format. ------=_NextPart_000_0007_01C326B4.300EC930 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable 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 pu= ll 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 ------=_NextPart_000_0007_01C326B4.300EC930 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable
PG: 7.3.3
Driver version: 7.03.01
 
I'm using VB as a front-end to end data in= to PG=20 database.  When I try to pull the current value of my serial field usi= ng=20 this code:
rs.open "selec= t=20 currval('public.hodiv_hodiv_id_seq');",CN
I get this error message:
ERROR: hodiv_hodiv_id_seq.currval is not y= et=20 defined in this session.
However, if use nextval it works fine.
rs.open "selec= t=20 nextval('public.hodiv_hodiv_id_seq');",CN
 
Any ideas?
 
TIA
Patrick
 

 

------=_NextPart_000_0007_01C326B4.300EC930-- From cgg007@yahoo.com Mon Jun 2 16:35:18 2003 X-Original-To: pgsql-odbc@postgresql.org Received: from localhost (developer.postgresql.org [64.117.224.193]) by developer.postgresql.org (Postfix) with ESMTP id 038AE92644E for ; Mon, 2 Jun 2003 12:35:18 -0400 (EDT) Received: from developer.postgresql.org ([64.117.224.193]) by localhost (developer.postgresql.org [64.117.224.193]) (amavisd-new, port 10024) with ESMTP id 21317-08 for ; Mon, 2 Jun 2003 12:35:07 -0400 (EDT) Received: from web13803.mail.yahoo.com (web13803.mail.yahoo.com [216.136.175.13]) by developer.postgresql.org (Postfix) with SMTP id 5AC89926442 for ; Mon, 2 Jun 2003 12:35:06 -0400 (EDT) Message-ID: <20030602163505.55124.qmail@web13803.mail.yahoo.com> Received: from [216.173.173.66] by web13803.mail.yahoo.com via HTTP; Mon, 02 Jun 2003 09:35:05 PDT Date: Mon, 2 Jun 2003 09:35:05 -0700 (PDT) From: Chris Gamache Reply-To: cgg007@yahoo.com Subject: Re: Currval not working To: Patrick Hatcher , pgsql-odbc@postgresql.org In-Reply-To: <000a01c326ee$dcd67520$02120a0a@D7MKWD21> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Virus-Scanned: by amavisd-new X-Archive-Number: 200306/12 X-Sequence-Number: 2986 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 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