X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id 4FBAAD1B4E6 for ; Mon, 8 Sep 2003 23:35:44 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 48491-06 for ; Mon, 8 Sep 2003 20:35:36 -0300 (ADT) Received: from sss.pgh.pa.us (unknown [192.204.191.242]) by svr1.postgresql.org (Postfix) with ESMTP id 616D8D1B4E3 for ; Mon, 8 Sep 2003 20:35:33 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.12.9/8.12.9) with ESMTP id h88NZNAn009435; Mon, 8 Sep 2003 19:35:24 -0400 (EDT) To: "scott.marlowe" Cc: Bruce Momjian , cgg007@yahoo.com, pgsql-sql@postgresql.org Subject: Re: undefine currval() In-reply-to: References: Comments: In-reply-to "scott.marlowe" message dated "Mon, 08 Sep 2003 17:03:39 -0600" Date: Mon, 08 Sep 2003 19:35:23 -0400 Message-ID: <9434.1063064123@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200309/55 X-Sequence-Number: 15033 "scott.marlowe" 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