From: | Bruce Momjian <bruce(at)momjian(dot)us> |
---|---|
To: | Adrian Klaver <adrian(dot)klaver(at)gmail(dot)com> |
Cc: | Nigel Heron <nigel(at)psycode(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgreSQL(dot)org> |
Subject: | Re: [GENERAL] currval and DISCARD ALL |
Date: | 2013-04-16 20:48:30 |
Message-ID: | 20130416204830.GE4602@momjian.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general pgsql-hackers |
On Tue, Apr 16, 2013 at 12:13:48PM -0700, Adrian Klaver wrote:
> On 04/16/2013 08:07 AM, Nigel Heron wrote:
> >
> >On 04/15/2013 05:57 PM, Adrian Klaver wrote:
> >>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.
> >>>
> ><snip>
> >>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, I read it (his blogs are always interesting!). I'm not disputing
> >that calling currval() at the wrong time is a bad idea.
> >I'm just wondering why DISCARD ALL clears everything but this?
>
> Well per the docs:
>
> http://www.postgresql.org/docs/9.2/interactive/sql-discard.html
>
> DISCARD ALL
>
> is equivalent to:
>
> SET SESSION AUTHORIZATION DEFAULT;
> RESET ALL;
> DEALLOCATE ALL;
> CLOSE ALL;
> UNLISTEN *;
> SELECT pg_advisory_unlock_all();
> DISCARD PLANS;
> DISCARD TEMP;
>
> AFAIK, none of the above affect sequences.
I think his point is why don't we clear currval() on DISCARD ALL? I
can't think of a good reason we don't. He is saying currval() should
throw an error after DISCARD ALL:
test=> SELECT currval('seq');
ERROR: currval of sequence "seq" is not yet defined in this session
I have moved this thead to hackers to get comments.
--
Bruce Momjian <bruce(at)momjian(dot)us> http://momjian.us
EnterpriseDB http://enterprisedb.com
+ It's impossible for everything to be true. +
From | Date | Subject | |
---|---|---|---|
Next Message | Ramsey Gurley | 2013-04-16 20:54:18 | Re: JDBC driver versions |
Previous Message | Dale Fukami | 2013-04-16 20:48:14 | Re: Mysterious table that exists but doesn't exist |
From | Date | Subject | |
---|---|---|---|
Next Message | Ants Aasma | 2013-04-16 20:59:12 | Re: Enabling Checksums |
Previous Message | Florian Pflug | 2013-04-16 20:20:26 | Re: Enabling Checksums |