From: | Adrian Klaver <adrian(dot)klaver(at)gmail(dot)com> |
---|---|
To: | Nigel Heron <nigel(at)psycode(dot)com> |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: currval and DISCARD ALL |
Date: | 2013-04-15 21:57:12 |
Message-ID: | 516C77B8.4060005@gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general pgsql-hackers |
On 04/15/2013 02:42 PM, Nigel Heron wrote:
> Hi,
> is there a way to clear the session state of sequence values fetched by
> currval(regclass)? "DISCARD ALL" doesn't seem to do it.
>
> eg. (w/ pg 9.2.4)
> test=# CREATE SEQUENCE foo_seq;
> CREATE SEQUENCE
> test=# SELECT nextval('foo_seq');
> -[ RECORD 1 ]
> nextval | 1
>
> test=# SELECT currval('foo_seq');
> -[ RECORD 1 ]
> currval | 1
>
> test=# DISCARD ALL;
> DISCARD ALL
> test=# SELECT currval('foo_seq');
> -[ RECORD 1 ]
> currval | 1
>
>
> I'm trying to migrate a large web app to work with pgbouncer's
> transaction pool mode and it would be easier to identify issues if
> currval() would return the usual "ERROR: currval of sequence "foo_seq"
> is not yet defined in this session" if nextval() wasn't called in the
> same pgbouncer session instead of getting old numbers from past
> transactions.
Might want to take a look at:
http://www.depesz.com/2012/12/02/what-is-the-point-of-bouncing/
for some hints on dealing with sequences and pgBouncer.
>
>
> thanks,
> -nigel.
>
>
--
Adrian Klaver
adrian(dot)klaver(at)gmail(dot)com
From | Date | Subject | |
---|---|---|---|
Next Message | Carlos Mennens | 2013-04-16 02:29:16 | Re: Role Authentication Failure |
Previous Message | Nigel Heron | 2013-04-15 21:42:17 | currval and DISCARD ALL |
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2013-04-15 22:51:38 | Re: Query not using index for user defined type |
Previous Message | Nigel Heron | 2013-04-15 21:42:17 | currval and DISCARD ALL |