Re: key = currval('tab_key_seq') choses SEQSCAN?! - Mailing list pgsql-general

From Eric Ridge
Subject Re: key = currval('tab_key_seq') choses SEQSCAN?!
Date
Msg-id 57550A96-689C-11D8-984A-000A95BB5944@tcdi.com
Whole thread Raw
In response to Re: key = currval('tab_key_seq') choses SEQSCAN?!  (Greg Stark <gsstark@mit.edu>)
List pgsql-general
On Feb 26, 2004, at 3:10 PM, Greg Stark wrote:

> Joe Conway <mail@joeconway.com> writes:
>
>> Eric B. Ridge wrote:
>>> gotcha.  Stated differently, it's not volatile because, by design,
>>> it doesn't
>>> always produce the same output for the same input.
>>
>> Right. But further, it doesn't even produce the same result within a
>> single
>> scan. Here's from pg_proc.h:
>
> Consider a query like
>
> select * from foo where a = currval('xyz') and b = nextval('xyz')

yeah, it never even occurred to me, until Joe Conway's comment
yesterday, that one could (or even would!) use nextval() and currval()
together in the same statement.

eric


pgsql-general by date:

Previous
From: "warwick.poole"
Date:
Subject: Postgres clustering?
Next
From: Bill Moran
Date:
Subject: Re: Hostname change - pgsql won't start