Re: undefine currval()

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "scott(dot)marlowe" <scott(dot)marlowe(at)ihs(dot)com>
Cc: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>, cgg007(at)yahoo(dot)com, pgsql-sql(at)postgresql(dot)org
Subject: Re: undefine currval()
Date: 2003-09-08 23:35:23
Message-ID: 9434.1063064123@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-sql

"scott.marlowe" <scott(dot)marlowe(at)ihs(dot)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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Ron Mayer 2003-09-08 23:46:13 Re: ISO 8601 'Time Intervals' of the 'format with time-unit deignators'
Previous Message Ron Mayer 2003-09-08 23:05:38 Re: [PATCHES] ISO 8601 "Time Intervals" of the "format with time-unit designators"

Browse pgsql-sql by date

  From Date Subject
Next Message Jomon Skariah 2003-09-09 04:14:03 Re: MINUS & ROWNUM in PostGres
Previous Message scott.marlowe 2003-09-08 23:03:39 Re: undefine currval()