Re: Behavior of nextval() and currval()

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Mike Mascari <mascarm(at)mascari(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Behavior of nextval() and currval()
Date: 2001-11-13 18:12:47
Message-ID: 2743.1005675167@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Mike Mascari <mascarm(at)mascari(dot)com> writes:
> The following works in 7.1. Is this behavior guaranteed or is it the
> subject of possible change in the future? Or am I just "getting
> lucky" that nextval() is evaluated before currval():

> SELECT nextval('s'), currval('s');

Hmm. SELECT target expressions are indeed evaluated left to right at
present, and I don't see any reason to change that --- but it's not
guaranteed by the spec AFAIK. I think you're right to be wary of
depending on it. Why would you need to do this anyway?

regards, tom lane

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Mike Mascari 2001-11-13 18:41:28 Re: Behavior of nextval() and currval()
Previous Message Bruce Momjian 2001-11-13 17:45:18 Re: Behavior of nextval() and currval()