Re: key = currval('tab_key_seq') choses SEQSCAN?!

From: Eric Ridge <ebr(at)tcdi(dot)com>
To: Greg Stark <gsstark(at)mit(dot)edu>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: key = currval('tab_key_seq') choses SEQSCAN?!
Date: 2004-02-26 20:42:49
Message-ID: 57550A96-689C-11D8-984A-000A95BB5944@tcdi.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Feb 26, 2004, at 3:10 PM, Greg Stark wrote:

> Joe Conway <mail(at)joeconway(dot)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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Bill Moran 2004-02-26 20:43:34 Re: Hostname change - pgsql won't start
Previous Message warwick.poole 2004-02-26 20:40:52 Postgres clustering?