[Pgpool-general] Re: pgpool / sessions / currval

Tatsuo Ishii ishii at sraoss.co.jp
Tue Jan 17 12:26:53 GMT 2006


> When using connection pooling, i presume it is safe to use the currval
> method to get last insert id?  My presumption is that the connections are
> shared and recycled, but new 'sessions' are created.  Is this in fact true?
> 
> thanks!

There's no such thing 'sessions' in pgpool. They are just reused
connections. Suppose in a connection A nextal is called, then currval
can be executed safely. If A is reused AND nextval has been already
called, then it seems as if currval can be called without nextval, but
it's just a coincidence.

Since there's way to know if nextval gets called in advance, I
recommend to call nextval before calling currval as usual in
PostgreSQL.
--
Tatsuo Ishii
SRA OSS, Inc. Japan


More information about the Pgpool-general mailing list