Skip site navigation (1) Skip section navigation (2)

Re: Fw: postgresql experts please help

From: Kris Jurka <books(at)ejurka(dot)com>
To: Mark Lewis <mark(dot)lewis(at)mir3(dot)com>
Cc: Andrei Ilitchev <andrei(dot)ilitchev(at)oracle(dot)com>, pgsql-jdbc(at)postgresql(dot)org, Marina Vatkina <Marina(dot)Vatkina(at)Sun(dot)COM>
Subject: Re: Fw: postgresql experts please help
Date: 2007-10-18 17:41:43
Message-ID: Pine.BSO.4.64.0710181340270.25640@leary.csoft.net (view raw, whole thread or download thread mbox)
Thread:
Lists: pgsql-jdbc

On Thu, 18 Oct 2007, Mark Lewis wrote:

> You haven't disabled JDBC autocommit for this connection.  That means
> that each statement gets executed in a separate transaction.
>
> Since currval is only valid within the scope of a single transaction,
> and you're executing your "select currval" from a separate transaction,
> that's why you can't see it.
>

False.  currval maintains state across transactions:

jurka=# create sequence myseq;
CREATE SEQUENCE
jurka=# begin;
BEGIN
jurka=# select nextval('myseq');
  nextval
---------
        1
(1 row)

jurka=# commit;
COMMIT
jurka=# select currval('myseq');
  currval
---------
        1
(1 row)


In response to

Responses

pgsql-jdbc by date

Next:From: Kris JurkaDate: 2007-10-18 17:45:58
Subject: Re: Fw: postgresql experts please help
Previous:From: Mark LewisDate: 2007-10-18 17:34:17
Subject: Re: Fw: postgresql experts please help

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group