Обсуждение: PostgreSQL order of evaluation

Поиск
Список
Период
Сортировка

PostgreSQL order of evaluation

От
Petter Reinholdtsen
Дата:
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).

Will PostgreSQL always be evaluating left-to-right?  Where in the
PostgreSQL manuals are this described?

BTW: I've implemented Oracles 'comment on' as functions.  Where should
  I send these functions and the perl tool to extract the comments?
--
##>  Petter Reinholdtsen  <##  |  pere@td.org.uit.no


Re: [GENERAL] PostgreSQL order of evaluation

От
Bruce Momjian
Дата:
> Will PostgreSQL always be evaluating left-to-right?  Where in the
> PostgreSQL manuals are this described?
>
> BTW: I've implemented Oracles 'comment on' as functions.  Where should
>   I send these functions and the perl tool to extract the comments?

Patches list.

--
  Bruce Momjian                        |  http://www.op.net/~candle
  maillist@candle.pha.pa.us            |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026