pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: scott.marlowe <scott.marlowe@ihs.com>
Cc: Bruce Momjian <pgman@candle.pha.pa.us>
Cc: cgg007@yahoo.com
Cc: pgsql-sql@postgresql.org
Subject: Re: undefine currval()
Date: Mon, 08 Sep 2003 19:35:23 -0400
Message-ID: <9434.1063064123@sss.pgh.pa.us> (raw)
In-Reply-To: <Pine.LNX.4.33.0309081701100.12311-100000@css120.ihs.com>
References: <Pine.LNX.4.33.0309081701100.12311-100000@css120.ihs.com>

"scott.marlowe" <scott.marlowe@ihs.com> writes:
> On Mon, 8 Sep 2003, Bruce Momjian wrote:
>> I don't know how you could have an application that doesn't know if it
>> has issued a nextval() in the current connection. Unless you can explain
>> that, we have no intention of playing tricks with currval() for
>> connection pooling.

> Actually, I would think the very act of using connection pooling would 
> ensure that applications may well not know whether or not a nextval had 
> been called.

The point is that it's not very sensible to be using currval except
immediately after a nextval --- usually in the same transaction, I would
think.  Certainly, not resetting currval implies that there is
*potential* coupling between different transactions that happen to share
a connection.  But ISTM that such coupling would represent a bug in the
application.

Chris said he was using currval being undefined to know that no rows
were inserted, but this seems less than compelling to me (why not look
at the results of the insert commands you used?).  I'd support adding a
currval-reset feature if someone can make a more compelling argument why
a connection-pooling application would need it.

There are big chunks of other state in the backend that are not
resettable --- prepared statements being one that I think will have much
more visibility in 7.4.  Should we offer something to let all prepared
statements be dropped?  Would connection poolers actually find it
useful?  (I'd think it much more likely they want to re-use prepared
statements.)

			regards, tom lane



view thread (7+ messages)  latest in thread

Message-ID: <9434.1063064123@sss.pgh.pa.us>
Permalink:  ../9434.1063064123@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/9434.1063064123@sss.pgh.pa.us

 · 

reply

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 using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: tgl@sss.pgh.pa.us, scott.marlowe@ihs.com, pgman@candle.pha.pa.us, cgg007@yahoo.com
  Subject: Re: undefine currval()
  In-Reply-To: <9434.1063064123@sss.pgh.pa.us>

* 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