Re: Behavior of nextval() and currval() - Mailing list pgsql-general

From Tom Lane
Subject Re: Behavior of nextval() and currval()
Date
Msg-id 2743.1005675167@sss.pgh.pa.us
Whole thread Raw
In response to Behavior of nextval() and currval()  (Mike Mascari <mascarm@mascari.com>)
Responses XML/PostgreSQL Application server now available  ("Command Prompt, Inc." <pgsql-general@commandprompt.com>)
List pgsql-general
Mike Mascari <mascarm@mascari.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

pgsql-general by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: Behavior of nextval() and currval()
Next
From: Jo
Date:
Subject: inheritance and foreign keys