>
> Date: Fri, 20 Aug 1999 01:25:54 +0200
> From: Petter Reinholdtsen <pere@hungry.com>
> Subject: PostgreSQL order of evaluation
>
> I've been trying to find where the order of evaluation for SQL is
> defined. In short, I wounder if the following always gives the same
> result:
>
> CREATE SEQUENCE counter
> start 1 increment 1 cache 1
> minvalue 1
> maxvalue 2147483647;
> SELECT NEXTVAL('counter'), NEXTVAL('counter');
>
> CREATE TABLE counts (
> value1 integer,
> value2 integer
> );
> INSERT INTO counts VALUES (NEXTVAL('counter'), NEXTVAL('counter'));
>
> Will the first always return (1, 2) or are the SQL implementations
> free to return (2,1). Will every SQL implementation insert (3,4) in
> the table, or will some insert (4,3).
>
Why are you so sure, that you may get numbers with differences of
one ? As I understand the backend caches several numbers in advance
and when running several backends you may also get numbers like
(1,10).
After all: the only thing you can be sure: both numbers are unique !
Marten