Re: PostgreSQL order of evaluation

From: marten(at)feki(dot)toppoint(dot)de
To: pgsql-general(at)hub(dot)org
Subject: Re: PostgreSQL order of evaluation
Date: 1999-08-22 16:23:56
Message-ID: 199908221623.JAA09740@feki.toppoint.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

>
> Date: Fri, 20 Aug 1999 01:25:54 +0200
> From: Petter Reinholdtsen <pere(at)hungry(dot)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

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Hub.Org News Admin 1999-08-22 18:02:59
Previous Message Ross J. Reedstrom 1999-08-21 17:33:58 Re: [GENERAL] RV: Serial fields