From: | Bruce Momjian <pgman(at)candle(dot)pha(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 17:45:18 |
Message-ID: | 200111131745.fADHjIA24745@candle.pha.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
> 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():
>
> CREATE SEQUENCE s;
>
> CREATE TABLE test (
> key1 int4,
> key2 int4
> );
>
> INSERT INTO test
> SELECT nextval('s'), currval('s');
>
> SELECT * FROM test;
>
> key1 | key2
> ------+------
> 1 | 1
>
> Thanks for any information,
So you are asking if the order of column function evaluations is
reliable. I tend to think so. I think the only thing that could
reorder it is rules.
--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 853-3000
+ If your life is a hard drive, | 830 Blythe Avenue
+ Christ can be your backup. | Drexel Hill, Pennsylvania 19026
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2001-11-13 18:12:47 | Re: Behavior of nextval() and currval() |
Previous Message | Paulo Jan | 2001-11-13 15:24:50 | Modifying check constraints |